Say I have a string coming in, "2007-02-28", what's the simplest code I could write to turn that into "2007-03-01"? Right now I'm just using strtotime(), then adding 24*60*60, then using date(), but just wondering if there is a cleaner, simpler, or more clever way of doing it.
"2007-02-28"
"2007-03-01"
strtotime()
24*60*60
date()
A clean way is to use strtotime()
$date = strtotime("+1 day", strtotime("2007-02-28")); echo date("Y-m-d", $date);
Will give you the 2007-03-01
1.4m articles
1.4m replys
5 comments
57.0k users