Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: ISO Date Week Number

by mattk (Pilgrim)
on Sep 06, 2005 at 07:44 UTC ( #489388=note: print w/ replies, xml ) Need Help??


in reply to ISO Date Week Number

This is assuming your install of v5.0 has a working POSIX.pm:

use POSIX 'strftime'; # replace with actual date my @localtime = qw/YYYY MM DD 00 00 00/; # see perldoc -f localtime $localtime[0] -= 1900; $localtime[1] -= 1; print strftime('%V', reverse @localtime);


Comment on Re: ISO Date Week Number
Download Code
Re^2: ISO Date Week Number
by halley (Prior) on Sep 06, 2005 at 15:39 UTC
    From my copy of (perldoc POSIX):
    If you want your code to be portable, your format ("fmt") argument should use only the conversion specifiers defined by the ANSI C standard. These are "aAbBcdHIjmMpSUwWxXyYZ%".
    I'm not familiar with the apparently non-standard %V code. Does that offer the "week number" as requested by the original poster? On what platform(s)?

    --
    [ e d @ h a l l e y . c c ]

      Yes, it corresponds to ISO's standard definition of a week number.

      Tested on:
      Linux 2.4.21, Perl v5.6.1
      Linux 2.6.10, Perl v5.8.3
      Mac OS X Tiger 10.4.2, Perl v5.8.6

      Of course, if the OP is still using v5.0 I've got no idea what kind of old OS they're using, so YMMV.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://489388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-08-21 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls