Bug #17965 Updated: Strftime returns day of the week 1 to high after 23-6-2002

From: Date: Wed, 26 Jun 2002 13:42:35 +0000
Subject: Bug #17965 Updated: Strftime returns day of the week 1 to high after 23-6-2002
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12130@lists.php.net to get a copy of this message
ID: 17965 Updated by: didier.peereboomvoller@o2.com Reported By: didier.peereboomvoller@o2.com Status: Open Bug Type: Date/time related Operating System: Linux 2.4.?? PHP Version: 4.1.2 New Comment: It maybe that the error lies in mktime instead. Previous Comments: ------------------------------------------------------------------------ [2002-06-25 05:57:49] didier.peereboomvoller@o2.com I use strftime("%y" , $var) to get the day of the week to display in a website. http://nieuws.online.o2.nl (dutch site, designed for a pda) However since 23-6-2002 (D/M/Y) it displays the day of the week as being one higher then it really is. 23 was a sunday. wich should make 24 monday. However it returns 2 both in %u and %w wich make it tuesday. I tried it on three different servers. one of them running 4.0.4pl1 and they all have the same problem. http://julia.o2.nl/problem.php (4.0.4) http://romeo.online.o2.nl/problem.php (4.1.2) Following is the code. I think I did everything right, according to the "it worked before" principle. 0 = zondag<br> 1 = maandag<br> 2 = dinsdag<br> 3 = woensdag<br> 4 = donderdag<br> 5 = vrijdag<br> 6 = zaterdag<br> 7 = zondag<br> <?php print(strftime("%u" , time()) . "<br>\n"); if(!ereg("([0-9]*)-([0-9]*)-([0-9]*) ([0-9]*):([0-9]*):([0-9]*)" , "2002-06-25 11:09:12" , $b)) Exit_Error("Invalid date format found"); // int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst]) $timestamp = mktime($b[3] , $b[5] , $b[6] , $b[2] , $b[3] , $b[1]); print("dag " . $b[3] . "<br>\n"); print("maand " . $b[2] . "<br>\n"); print("jaar " . $b[1] . "<br>\n"); print("uur " . $b[4] . "<br>\n"); print("min " . $b[5] . "<br>\n"); print("sec " . $b[6] . "<br>\n"); print($timestamp . "<br>\n"); print(strftime("DAG 1 = maandag [%u] DAG 0 = zondag [%w]" , $timestamp) . "<br>\n"); print("------------------------<br>\n"); if(!ereg("([0-9]*)-([0-9]*)-([0-9]*) ([0-9]*):([0-9]*):([0-9]*)" , "2002-06-23 11:09:12" , $b)) Exit_Error("Invalid date format found"); // int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst]) $timestamp = mktime($b[3] , $b[5] , $b[6] , $b[2] , $b[3] , $b[1]); print("dag " . $b[3] . "<br>\n"); print("maand " . $b[2] . "<br>\n"); print("jaar " . $b[1] . "<br>\n"); print("uur " . $b[4] . "<br>\n"); print("min " . $b[5] . "<br>\n"); print("sec " . $b[6] . "<br>\n"); print($timestamp . "<br>\n"); print(strftime("DAG 1 = maandag [%u] DAG 0 = zondag [%w]" , $timestamp) . "<br>\n"); print("------------------------<br>\n"); if(!ereg("([0-9]*)-([0-9]*)-([0-9]*) ([0-9]*):([0-9]*):([0-9]*)" , "2002-06-24 11:09:12" , $b)) Exit_Error("Invalid date format found"); // int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst]) $timestamp = mktime($b[3] , $b[5] , $b[6] , $b[2] , $b[3] , $b[1]); print("dag " . $b[3] . "<br>\n"); print("maand " . $b[2] . "<br>\n"); print("jaar " . $b[1] . "<br>\n"); print("uur " . $b[4] . "<br>\n"); print("min " . $b[5] . "<br>\n"); print("sec " . $b[6] . "<br>\n"); print($timestamp . "<br>\n"); print(strftime("DAG 1 = maandag [%u] DAG 0 = zondag [%w]" , $timestamp) . "<br>\n"); ?> ~ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17965&edit=1

« previous php.bugs (#12130) next »