Re: Some date() oddities
| From: | Daniel Brown | Date: | Tue, 08 Jan 2013 20:56:34 +0000 |
| Subject: | Re: Some date() oddities | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320055@lists.php.net to get a copy of this message | ||
On Tue, Jan 8, 2013 at 3:43 PM, Arno Kuhl <arno@dotcontent.net> 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 = date("W", $ux_date); // returns 01 instead of 52
Because, technically, 31 December was the second date of the
*fifty-third* week of 2012. However, because the majority of the week
falls in 2013, it's rounded-in with that.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/