RE: [PHP] Some date() oddities

From: Date: Wed, 09 Jan 2013 10:22:02 +0000
Subject: RE: [PHP] Some date() oddities
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-320058@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 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. -- Thanks Geoff, that's what I was looking for. Cheers Arno

« previous php.general (#320058) next »