#22163 [Fbk->Opn]: mktime returns -3662

From: Date: Wed, 12 Feb 2003 11:53:06 +0000
Subject: #22163 [Fbk->Opn]: mktime returns -3662
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32880@lists.php.net to get a copy of this message
ID: 22163 User updated by: andrew@strawberry-world.com Reported By: andrew@strawberry-world.com -Status: Feedback +Status: Open Bug Type: Date/time related Operating System: MacOS X 10.2 PHP Version: 4.3.0 New Comment: ok, I used the script: <?PHP $the_day=mktime(0,0,0,3,30,2003); echo "$the_day<br>"; echo "23:59:59 29-Mar = ", mktime(23, 59, 59, 3, 29, 2003), "; 01:00:01 30-Mar = ", mktime(1, 0, 1, 3, 30, 2003); ?> and got: -3662 23:59:59 29-Mar = 1048982399; 01:00:01 30-Mar = -61 I thought it might be a daylight savings time problem as well, hence I thought the extra parameter I normally use would solve the problem, but it didn't. i.e. $the_day=mktime(0,0,0,3,30,2003,0); Previous Comments: ------------------------------------------------------------------------ [2003-02-12 05:31:04] mgf@php.net Of course, I meant "; 01:00:01 30-Mar = " in the second line (although the mktime() call is correct)! ------------------------------------------------------------------------ [2003-02-12 05:27:07] mgf@php.net 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 ------------------------------------------------------------------------ [2003-02-12 02:31:17] andrew@strawberry-world.com Yes, I have also tried (and just tried it again to make sure): $the_day=mktime(0,0,0,3,30,2003); Same result, -3662 Anything else I can try to narrow down where the problem might be lying? ------------------------------------------------------------------------ [2003-02-11 15:29:51] sniper@php.net Did you try: $the_day=mktime(0,0,0,3,30,2003); ?? ------------------------------------------------------------------------ [2003-02-11 14:55:01] andrew@strawberry-world.com Sorry if I misunderstand, but as my first post shows I have tried the year as 2003, as well as 03. No difference, and using the 29th as the day instead works. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22163 -- Edit this bug report at http://bugs.php.net/?id=22163&edit=1

« previous php.bugs (#32880) next »