Re: Some date() oddities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Cheers,
Geoff.


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux