Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: calcweek

by Krambambuli (Curate)
on Aug 20, 2008 at 11:28 UTC ( [id://705484]=note: print w/replies, xml ) Need Help??


in reply to calcweek

Not to muck about it, but where would the main differences/benefits be against something like
perl -MDate::Manip -e 'print UnixDate( "next Sunday", "%W"), "\n";'

?

Thanks,

Krambambuli
---
sometimes enjoying Mark Jason Dominus' Higher-Order Perl

Replies are listed 'Best First'.
Re^2: calcweek
by Skeeve (Parson) on Aug 20, 2008 at 16:12 UTC

    I'm not 100% sure but calendar weeks in Europe and US of A differ. ISO 8601 start with Monday while US weeks start on Sunday.

    Also the definition of the first week differ.

    • in US it's the week containing January 1st.
    • in ISO 8601 it's the week having at least 4 days

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
Re^2: calcweek
by sv87 (Acolyte) on Aug 20, 2008 at 16:05 UTC
    I didn't even know about the existence of Date::Manip, and your solution works as well. I'm a relative noob in Perl. But hey, according to the Perl spirit, TIMTOWTDI (there's more than one way to do it). :-) thanks for your reply. Now I know a way to do it that's a lot shorter. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-23 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found