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 52

I'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.


Thanks Geoff, that's what I was looking for.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to