Increment date by one day | < PHP 5.2

If you want to increment a date by one day you need to do it using the PHP DateTime function so that you can account for leap years.

$time_stamp = strtotime('0000-00-00 00:00:00');
$date = new DateTime();
$date->add(new DateInterval('P1D'));
echo $date->format('l dS \o\f F Y h:i:s A') . "\n";

Compatible with (PHP 5 >= 5.2.0)
to check your PHP version run
or if you are running the below script from the command line
php -v;

note: php -v does not get the version of your php that you are running as an ISAPI module on the web server.

comments powered by Disqus