Re: Some date() oddities
| From: | Geoff Shang | Date: | Tue, 08 Jan 2013 21:02:34 +0000 |
| Subject: | Re: Some date() oddities | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320057@lists.php.net to get a copy of this message | ||
On Tue, 8 Jan 2013, Arno Kuhl wrote:
Starting with a unix timestamp for 31 December 2012 13:12:12 (which is 1356952332) I calculate a week number: $ux_date = 1356952332; $weeknumber = date("W", $ux_date); // returns 01 instead of 52I'm not that familiar with date, I tend to use strftime myself (no idea why there's both). Sounds like date's W is equivalent to strftime's %V which does indeed return "01" for this date as there's at least 4 days of the new year in that particular week. Both %U and %W seem to return what you want, using strftime. I'd guess that date would also have flags for these. Cheers, Geoff.