Re: PHP date: ISO year = loss of hair
| From: | Richard Lynch | Date: | Fri, 14 Dec 2007 16:59:00 +0000 |
| Subject: | Re: PHP date: ISO year = loss of hair | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265893@lists.php.net to get a copy of this message | ||
On Fri, December 14, 2007 2:02 am, Arno Kuhl wrote:
> I'm battling with getting the last week number using date(W,
> $unixdate). If
> the date is 30 December 2007 ($unixdate=1198965600) then date(W,
> $unixdate)
> returns 01. I know that according to the ISO spec, the last week of
> the ISO
> year has 28 December in it, so in this particular case the last week
> number
> of the ISO year is 52. However 30 December is in the following week,
> week
> 53. How do I get the correct value of 53 for 30 December 2007?
>
> I'm thinking along the lines of: if the date is greater than 28
> December
> then use the week number of 28 December; then check every day between
> 28
> December and the date to see if a Sunday occurs and if so add one to
> the
> week number. It looks like it will work but seems ridiculously
> laboured for
> such a simple issue. Am I overlooking something obvious here - is
> there
> something I've missed about PHP date? Any pointers would be greatly
> appreciated.
I think Arlo Leach fought this battle and posted here or in the
Chicago PHP User Group about it...
You should be able to find PHP-General archives easily enough.
The Chicago group ones are here:
http://sourceforge.net/mailarchive/forum.php?forum_name=chiphpug-discuss
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?