Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: ISO 8601 week number

by jasonk (Parson)
on Sep 20, 2008 at 02:13 UTC ( #712678=note: print w/ replies, xml ) Need Help??

in reply to ISO 8601 week number

Or the really easy way...

use DateTime; print DateTime->now->week_number,"\n";
We're not surrounded, we're in a target-rich environment!

Comment on Re: ISO 8601 week number
Download Code
Re^2: ISO 8601 week number
by wol (Hermit) on Sep 21, 2008 at 11:14 UTC
    I'll vote for that.

    Sigh. I don't know how long I looked for a simple solution before I gave up and wrote one, but somehow I never saw the DateTime option. Still, I think it's worth publishing the algorithm, even if it's only a benefit for people who need to implement it in something other than perl...

    I might simplify some code next week.

    PS - I wonder why I can see the module on CPAN, but not via PPM in any of Active's repositories

Re^2: ISO 8601 week number
by larryk (Friar) on Mar 28, 2014 at 11:15 UTC
    And nowadays the same thing with a core module

    perl -MTime::Piece -e "print localtime->week"

    perl -le "s,,reverse killer,e,y,rifle,lycra,,print"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-05-30 19:23 GMT
Find Nodes?
    Voting Booth?

    In my home, the TV remote control is ...

    Results (599 votes), past polls