Bug #13992 Updated: 31st of month causes date function to 'skip'

From: Date: Thu, 08 Nov 2001 18:49:05 +0000
Subject: Bug #13992 Updated: 31st of month causes date function to 'skip'
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-69819@lists.php.net to get a copy of this message
ID: 13992 Updated by: cnewbill Reported By: john@londonriverside.co.uk Status: Bogus Bug Type: Date/time related Operating System: HP PHP Version: 4.0.4 New Comment: This is not a bug. mktime and date are doing exactly what you told them to...take an long int date and convert it into something human readable. It is not skipping it is simply giving you the accurate date for what mktime returned based on your input. -Chris Bug along the same lines http://bugs.php.net/bug.php?id=13888 Previous Comments: ------------------------------------------------------------------------ [2001-11-08 13:44:22] derick@php.net I'm pretty sure this is not a bug, and your example URI didn't show anything. Please ask support questions on the php-general@lists.php.net mailinglist. Derick ------------------------------------------------------------------------ [2001-11-08 13:36:36] john@londonriverside.co.uk See my web page on 31st of a month and notice how the months and/or days repeat: eg January, January, March, March etc. www.londonriverside.co.uk/datebug.php This is the code on the server: <html> <head> </head> <body> //Select FromDay print ("<select name=\"FromDay\">"); for ($x=1; $x<=31; $x++) { if (sprintf("%02d", date(d, mktime(0,0,0,1,$x,date("Y")))) == date(d) AND !ISSET($FromDay)) { echo "<option value=\"" . sprintf("%02d", date(d, mktime(0,0,0,1,$x,date("Y")))) . "\" selected>" . date(d, mktime(0,0,0,1,$x,date("Y"))) . "</option>\n"; } elseif (sprintf("%02d", date(d, mktime(0,0,0,1,$x,date("Y")))) <> $FromDay) { echo "<option value=\"" . sprintf("%02d", date(d, mktime(0,0,0,1,$x,date("Y")))) . "\">" . date(d , mktime(0,0,0,1,$x,date("Y"))) . "</option>\n"; } else { echo "<option value=\"" . sprintf("%02d", date(d, mktime(0,0,0,1,$x,date("Y")))) . "\" selected>" . date(d, mktime(0,0,0,1,$x,date("Y"))) . "</option>\n"; } } print ("</select>"); //Select FromMonth print ("</td>\n<td width=50><font face=verdana size=2>Month</font></td>\n<td width=61>"); print ("<select name=\"FromMonth\">"); for ($x=1; $x<=12; $x++) { if (sprintf("%02d", date(m, mktime(0,0,0,$x,date("d"),date("Y")))) == date(m) AND !ISSET($FromMonth)) { echo "<option value=\"" . sprintf("%02d", date(m, mktime(0,0,0,$x,date("d"),date("Y")))) . "\" selected>" . date(M , mktime(0,0,0,$x,date("d"),date("Y"))) . "</option>\n"; } elseif (sprintf("%02d", date(m, mktime(0,0,0,$x,date("d"),date("Y")))) <> $FromMonth) { echo "<option value=\"" . sprintf("%02d", date(m, mktime(0,0,0,$x,date("d"),date("Y")))) . "\">" . date(M, mktime(0,0,0,$x,date("d"),date("Y"))) . "</option>\n"; } else { echo "<option value=\"" . sprintf("%02d", date(m, mktime(0,0,0,$x,date("d"),date("Y")))) . "\" selected>" . date(M , mktime(0,0,0,$x,date("d"),date("Y"))) . "</option>\n"; } } print ("</select>"); ?> </body> </html> Regards, John ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13992&edit=1

« previous php.dev (#69819) next »