Re: Some date() oddities
| From: | Sebastian Krebs | Date: | Tue, 08 Jan 2013 20:57:04 +0000 |
| Subject: | Re: Some date() oddities | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320056@lists.php.net to get a copy of this message | ||
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 Kuhl <arno@dotcontent.net>
> 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 = date("W", $ux_date); // returns 01 instead of 52
>
>
>
> I found some warnings regarding ISO8601 for this in the user notes for the
> date() function in the PHP manual but couldn't see how this is managed in
> code, does anyone know of a workaround for this?
>
>
>
> Cheers
>
> Arno
>
>
>
>
>
>
--
github.com/KingCrunch