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

From: Date: Wed, 12 Feb 2003 11:27:08 +0000
Subject: #22163 [Opn->Fbk]: mktime returns -3662
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32878@lists.php.net to get a copy of this message
ID: 22163 Updated by: mgf@php.net Reported By: andrew@strawberry-world.com -Status: Open +Status: Feedback Bug Type: Date/time related Operating System: MacOS X 10.2 PHP Version: 4.3.0 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2003-02-11 10:22:27] iliaa@php.net I think that for some reason on your system, 03 is interpreted as 0003 and not 2003 as you intended (works fine on linux). Could you try changing the year to 2003 and see if that fixes the problem? ------------------------------------------------------------------------ [2003-02-11 04:51:50] andrew@strawberry-world.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22163&edit=1

« previous php.bugs (#32878) next »