|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-10-09 07:55 UTC] sandro dot casa at gmail dot com
Description: ------------ --- From manual page: http://www.php.net/function.date --- l (lowercase 'L'): A full textual representation of the day of the week Sunday through Saturday N ISO-8601: numeric representation of the day of the week (added in PHP 5.1.0) 1 (for Monday) through 7 (for Sunday) My PHP version is 5.5.6 Test script: --------------- // My PHP version is 5.5.6 $date = '1900-01-01'; echo date('N', strtotime($date)); // ==> 4 echo date('l', strtotime($date)); // ==> Thurday The thing is the 1st of Jan 1900 was a Monday... Expected result: ---------------- $date = '1900-01-01'; echo date('N', strtotime($date)); // ==> 1 echo date('l', strtotime($date)); // ==> Monday PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 06:00:01 2026 UTC |
Unless you're running one of the experimental builds of PHP x64 for Windows (and probably not even then), your PHP cannot handle 1900 as a Unix timestamp. It's too far in the past for a 32-bit number. strtotime() will fail, which means it will return false, which is basically 0, which corresponds to 1970-01-01. Try it: echo date('r', strtotime($date)); Fortunately, DateTime works differently. $date = new DateTime('1900-01-01'); echo $date->format('N'); // 1 echo $date->format('l'); // Monday