Entry
How can I figure the correct date n hours from now while avoiding daylight savings time adjustments?
Jul 6th, 1999 21:43
Leon Atkinson,
The following script adds an hour to the current date. Note that even
though the number of seconds exceeds the normal range of 0 to 59, the
date will be figured correctly by mktime(). If daylight savings time
happens in the next hour, mktime() will adjust for this as well.
<?
//get current timestamp
list($hour, $min, $sec, $day, $mon, $yr) =
explode(" ",date("H i s d m y"));
//print time 3600 seconds (1 hour) from now
print(date(date("H i s d m y"),
mktime($hour, $min, $sec+3600, $mon, $day, $yr));
?>