PHP 4.0 Bug #8828: mktime using mday<=0
| From: | dieter at fiebelkorn dot net | Date: | Sun, 21 Jan 2001 13:06:36 +0000 |
| Subject: | PHP 4.0 Bug #8828: mktime using mday<=0 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44675@lists.php.net to get a copy of this message | ||
From: dieter@fiebelkorn.net
Operating system: MacOS X (Darwin 1.2)
PHP version: 4.0.4pl1
PHP Bug Type: Date/time related
Bug description: mktime using mday<=0
On PHP documantation:
mktime(hour,min,sec, year,0,mon) refers the last day of
month 'mon-1'. On MacOS X this failed, there it refers
the first day of month 'mon' and mktime(hour,min,sec,
year,-1,mon) refers the last day of month 'mon-1'.
See the test:
[aragorn:~/Downloads] dieter% cat A.c
#include <stdio.h>
#include <time.h>
main()
{
struct tm mytm;
int i;
mytm.tm_sec = 0; mytm.tm_min = 0;
mytm.tm_hour = 0; mytm.tm_year = 101;
mytm.tm_wday = 0; mytm.tm_yday = 0;
mytm.tm_isdst = 0; mytm.tm_gmtoff = 0;
mytm.tm_zone = 0;
for (i = 2; i >= -2; i--)
{
mytm.tm_mday = i;
mytm.tm_mon = 2;
printf ("%02d.%02d ",
mytm.tm_mday, mytm.tm_mon+1);
printf (" --> %ld", mktime(&mytm));
printf (" --> %02d.%02d\n",
mytm.tm_mday, mytm.tm_mon+1);
}
}
[aragorn:~/Downloads] dieter% cc -o A A.c
[aragorn:~/Downloads] dieter% ./A
02.03 --> 983487600 --> 02.03
01.03 --> 983401200 --> 01.03
00.03 --> 983401200 --> 01.03
-1.03 --> 983314800 --> 28.02
-2.03 --> 983228400 --> 27.02
[aragorn:~/Downloads] dieter%
--
Edit Bug report at: http://bugs.php.net/?id=8828&edit=1