|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-11 04:51 UTC] andrew at strawberry-world dot com
Hello the function mktime seems to return an incorrect value for certain dates. Example: $the_day=mktime(0,0,0,03,30,03); returns the value -3662 I have also tried different variations: $the_day=mktime(0,0,0,3,30,03); $the_day=mktime(0,0,0,03,30,2003); But all yield the same result. If I use: $the_day=mktime(0,0,0,03,29,03); I get a UNIX timestamp back as expected. When using the mktime() function I normally also specify the daylight savings time value of 0, but this also makes no difference, whether it is 0 or 1. I am using PHP as built by www.entropy.ch PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
I think this must be related to daylight savings time -- 30th March 2003 is certainly the date on which DST begins in western Europe. Can you try this, and see what you get: echo "23:59:59 29-Mar = ", mktime(23, 59, 59, 3, 29, 2003), "; 00:00:01 30-Mar = ", mktime(1, 0, 1, 3, 30, 2003); If those timestamps are 2 seconds apart, then your original mktime() is falling into the limbo of the "lost hour" due to the clocks going back (the second after 29-Mar-2003 23:59:59 must be regarded as 30-Mar-2003 01:00:00), and the algorithm used on your system returns a nonsense value when that happens. Mike