PHP 4.0 Bug #8828 Updated: mktime using mday<=0

From: Date: Tue, 23 Jan 2001 03:32:57 +0000
Subject: PHP 4.0 Bug #8828 Updated: mktime using mday<=0
Groups: php.dev 
Request: Send a blank email to php-dev+get-44790@lists.php.net to get a copy of this message
ID: 8828 Updated by: jimw Reported By: dieter@fiebelkorn.net Old-Status: Open Status: Closed Bug Type: Date/time related Assigned To: Comments: macos x is behaving in a non-standard way. we just use the underlying mktime() function. you might try reporting it to the darwin developers. http://www.opensource.apple.com/projects/bugs.html Previous Comments: --------------------------------------------------------------------------- [2001-01-21 08:06:36] dieter@fiebelkorn.net 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.%02dn", 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% --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8828

« previous php.dev (#44790) next »