note 10253 added to localtime
| From: | sub9 at hotmail dot com | Date: | Wed, 20 Dec 2000 23:58:50 +0000 |
| Subject: | note 10253 added to localtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8983@lists.php.net to get a copy of this message | ||
The comment 'tm_year - not y2k compliant' is incorrect. The tm_year field is specified by
the C library as 'the number of years since 1900', but many people assume it is 'last
two digits of the year', which it isn't. As specified, its perfectly y2k compliant.
So, if you made the obvious mistake of printing '19',tm_year, you got 'jan 1
19100' on the first day of the year 2000.
You should instead use, 1900+tm_year as a 4 digit date in all your calculations and printing.
Many perl users made the same mistake, which was very visible when y2k came around, but its really
an issue with the underlying 'C' library function, not php or perl.
http://www.php.net/manual/function.localtime.php