#21966 [Opn->Bgs]: date() or mktime() returning bad value for mktime month param of '2'
| From: | iliaa@php.net | Date: | Sat, 01 Feb 2003 00:40:56 +0000 |
| Subject: | #21966 [Opn->Bgs]: date() or mktime() returning bad value for mktime month param of '2' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31820@lists.php.net to get a copy of this message | ||
ID: 21966
Updated by: iliaa@php.net
Reported By: david@sxsw.com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Gentoo Linux 1.4
PHP Version: 4.2.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Reason explained in previous comment.
Previous Comments:
------------------------------------------------------------------------
[2003-01-30 13:26:11] michael.mauch@gmx.de
See what you get if you use the "r" format:
# php -r 'for($x=1; $x<=3; $x++) {
echo "$x = ".date("r", mktime(0,0,0,$x))."\n"; }'
1 = Thu, 30 Jan 2003 00:00:00 +0100
2 = Sun, 2 Mar 2003 00:00:00 +0100
3 = Sun, 30 Mar 2003 00:00:00 +0100
So apparently the "February, 30th" is turned into its normal
representation by mktime(). Although that doesn't seem to be
documented, I think that's a feature, because it helps doing date
calculations.
------------------------------------------------------------------------
[2003-01-30 12:40:30] david@sxsw.com
#!/usr/bin/php -q
<?
system("cat test");
for($x=1; $x<=12; $x++) {
echo "$x = ".date("m", mktime(0,0,0,$x))."\n";
}
?>
1 = 01
2 = 03
3 = 03
4 = 04
5 = 05
6 = 06
7 = 07
8 = 08
9 = 09
10 = 10
11 = 11
12 = 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21966&edit=1