1 min read
php date() and mktime() example
This can be more reliable than simply adding or subtracting the number
of seconds in a day or month to a timestamp because of daylight saving
time.
of seconds in a day or month to a timestamp because of daylight saving
time.
<?php
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
$nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1);
?>