note 36939 deleted from function.mktime by didou
| From: | didou@php.net | Date: | Tue, 28 Oct 2003 09:04:37 +0000 |
| Subject: | note 36939 deleted from function.mktime by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59405@lists.php.net to get a copy of this message | ||
Note Submitter: paca@sci.fi
----
>$i = mktime(0,0,0,10,22,2003) in a loop adding 86400 to it will
>produce incorrect date('d',$i) results. Ik getting 2 times the 26 th of >october
>this way. I think because incorrect rounding the results.
>use mktime(12,0,0,10,22,2003) instead.
Problem is daylightsavings time. I use function like:
function nextdaysec($time, $numdays = 1) {
// takes unix timestamp and returns
// next days timestamp (+ 86400 sec all otherday but daylightsavings)
$atoms = explode(".",date("H.i.s.n.j.Y", $time));
$result=(mktime($atoms[0],
$atoms[1],
$atoms[2],
$atoms[3],
($atoms[4]+$numdays),
$atoms[5]));
return $result;
}
... to increment my timestamps. Maybe it could be lighter, but at least it works correctly.