Ask a Question related to PERL Beginners, Design and Development.
-
Bob Showalter #1
RE: Convert Date to week number
Tim wrote:
ISO8601 defines a standard, but not everyone follows it. See:> At 03:16 PM 1/23/04 +0000, you wrote:>>> ...
>> Why not write it yourself?
>>
>> You need to know:
>>
>> - Which day of the week is the 'first'.
>>
>> - Which was the first week of the year that had four or more days.
>> That's week one.
>>
>> Then do the sums/arithmetic/math/mathematics/calculations (what /do/
>> people prefer?)
>>
>> .....
>> Rob
> This message thread made me curious about just what constitutes the
> first week of the year. Is there a standard definition or are we
> making one here?
>
> Tim
[url]http://www.mcs.vuw.ac.nz/technical/software/SGML/doc/iso8601/ISO8601.html[/url]
Excerpt:
"An ordinal date is identified by a given day in a given year. A week is
identified by its number in a given year. A week begins with a Monday, and
the first week of a year is the one which includes the first Thursday, or
equivalently the one which includes January 4."
Here's January, 2004:
$ cal 1 2004
January 2004
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Since weeks start on Monday, the week ending on Sunday, January 4 was week
1.
The DateTime family of modules on CPAN supports this standard.
Bob Showalter Guest
-
#39912 [NEW]: date('W') returns wrong week number for some dates
From: pkus at epf dot pl Operating system: windows xp PHP version: 5.2.0 PHP Bug Type: *General Issues Bug description: ... -
Date Range from Week Number
Has anyone ever tried to create a date range from a week number? Here is my scenario: I have a database with a primary key of weekNum. There are... -
Code for telling the week number on a specific date
I've been annoyed that the Date class had no ability to tell which week a certain date fell within. So I created a function that will take any date... -
Covert Date to week number
Is their a way in PERL to covert a date to a week number Cheers Neill -
Parsing a date from the week number of a given year from request post
I'm trying to get the date from a request-query post that contains a year (request("season") and a week number from that year... -
Rob Dixon #2
Re: Convert Date to week number
Bob Showalter wrote:
Thanks Bob. It's always nice to have a document to prod.>
> ISO8601 defines a standard, but not everyone follows it. See:
>
> [url]http://www.mcs.vuw.ac.nz/technical/software/SGML/doc/iso8601/ISO8601.html[/url]
>
> Excerpt:
>
> "An ordinal date is identified by a given day in a given year. A week is
> identified by its number in a given year. A week begins with a Monday, and
> the first week of a year is the one which includes the first Thursday, or
> equivalently the one which includes January 4."
>
> Here's January, 2004:
>
> $ cal 1 2004
> January 2004
> Su Mo Tu We Th Fr Sa
> 1 2 3
> 4 5 6 7 8 9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28 29 30 31
>
> Since weeks start on Monday, the week ending on Sunday, January 4 was week
> 1.
>
> The DateTime family of modules on CPAN supports this standard.
Strange though, since
yet the tabulation starts on Sunday.> A week begins with a Monday
Rob
Rob Dixon Guest



Reply With Quote

