note 80148 deleted from function.date by peehaa

From: Date: Fri, 06 Jan 2017 15:55:16 +0000
Subject: note 80148 deleted from function.date by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208704@lists.php.net to get a copy of this message
Note Submitter: jc ---- 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. [edit: Much easier is to use "o" (lower case O) instead of "Y"]

« previous php.notes (#208704) next »