Page 1 of 1
Date question
Posted: Tue Nov 01, 2011 1:58 pm
by spacebiscuit
Hi,
I have pulled a date from a database in the format:
YYY-MM-DD
If I want to add a day to this date can it be done in PHP?
Thanks.
Re: Date question
Posted: Tue Nov 01, 2011 1:59 pm
by Celauran
Re: Date question
Posted: Tue Nov 01, 2011 2:03 pm
by spacebiscuit
Thankls I can't see how that will work though as it seems to work with unix time stamps?
Re: Date question
Posted: Tue Nov 01, 2011 2:24 pm
by Celauran
Code: Select all
$date = "2011-11-01";
$unix_time = strtotime($date);
$tomorrow = strtotime("+1 day", $unix_time);
echo date("Y-m-d", $tomorrow);
Better still, select the date as UNIX_TIMESTAMP from your database and save yourself some steps.