note 80148 added to function.date
| From: | jc at osu1 dot php dot net | Date: | Mon, 31 Dec 2007 14:28:55 +0000 |
| Subject: | note 80148 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134628@lists.php.net to get a copy of this message | ||
date("W") returns the iso8601 week number, while date("Y") returns the _current_
year. This can lead to odd results. For example today (dec 31, 2007) it returns 1 for the week and
of course 2007 for the year. This is not wrong in a strict sense because iso defines this week as
the first of 2008 while we still have 2007.
So, if you don't have another way to safely retrieve the year according to the iso8061
week-date - strftime("%G") doesn't work on some systems -, you should be careful when
working with date("W").
For most cases strftime("%W") should be a safe replacement.
----
Server IP: 217.13.201.10
Probable Submitter: 80.171.71.190
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/80148
Del: integrated -- https://master.php.net/note/delete/80148/integrated
Del: useless -- https://master.php.net/note/delete/80148/useless
Del: bad code -- https://master.php.net/note/delete/80148/bad+code
Del: spam -- https://master.php.net/note/delete/80148/spam
Del: non-english -- https://master.php.net/note/delete/80148/non-english
Del: in docs -- https://master.php.net/note/delete/80148/in+docs
Del: other reasons-- https://master.php.net/note/delete/80148
Reject -- https://master.php.net/note/reject/80148
Search -- https://master.php.net/manage/user-notes.php