Re: [PHP] Some date() oddities

2013-01-09 Thread Jani Ollikainen
On 9.1.2013 12:22, Arno Kuhl wrote: Both %U and %W seem to return what you want, using strftime. I'd guess that date would also have flags for these. No. That's one thing I've wondered sometimes. According to documentation: strftime has: Week--- --- %U Week number of the given year,

RE: [PHP] Some date() oddities

2013-01-09 Thread Arno Kuhl
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 str

Re: [PHP] Some date() oddities

2013-01-08 Thread Geoff Shang
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 m

Re: [PHP] Some date() oddities

2013-01-08 Thread Sebastian Krebs
Hi, Workaround for what? The 31st of december is the first week of the ISO8601-year 2013. That has nothing to do with PHP, date(), or any warnings somebody left in the comments. Thats the way ISO8601 is defined: http://en.wikipedia.org/wiki/ISO_8601#Week_dates Regards, Sebastian 2013/1/8 Arno K

Re: [PHP] Some date() oddities

2013-01-08 Thread Daniel Brown
On Tue, Jan 8, 2013 at 3:43 PM, Arno Kuhl wrote: > I've bumped into an odd result with the date() function that I can't make > sense of. > > Starting with a unix timestamp for 31 December 2012 13:12:12 (which is > 1356952332) I calculate a week number: > > $ux_date = 1356952332; > > $weeknumber =