I am getting the current date and time using date(“Y-m-d, H:i:s”). How do I increment this by 1 day such that output is in “Y-m-d, H:i:s” format? I have tried several implementations of strtotime() but can’t get it to work.
@bubbisthedogauthorNov 27.2010 — #Well I came back to thank eval(BadCode) for the help, and noticed NogDog's response. I had originally tried using strtotime(), which appeared at the time to be a cleaner approach; I just wasn't using it correctly. Anyway, here's what I used according to eval's advice, which worked just fine: [code=php] $OneDayAgoPrep = mktime(0,0,0,date("m"),date("d")-1,date("Y")); $OneDayAgo = date("Y-m-d", $OneDayAgoPrep) . ' ' . date("H:i:s"); [/code] I think I am going to use NogDog's solution, however.
NOTE: Turns out I needed to decrement the date, not increment it.
Thanks, eval and NogDog, for taking the time to help me.