Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Calculating the "nearest" weekby hacker (Priest) |
on Apr 25, 2005 at 01:31 UTC ( [id://451069]=perlquestion: print w/replies, xml ) | Need Help?? |
hacker has asked for the wisdom of the Perl Monks concerning the following question: A confusing node title, but please read on... I'm trying to come up with a simple little script that can spit out a week's worth of days (5 work days), regardless of what day I execute the script on. For example, if I run the script on Saturday (i.e. the 6th day of the week), I want it to output the previous Monday through Friday. If I execute the script on Wednesday, it should output the Monday of that week, Tuesday, Wednesday (the day I run it), tomorrow (Thursday) and the day after (Friday). This is more of a math question than Perl I suppose. Is there an easy way to find the closest week to the day I execute the script? It will either be the previous week, or the current week, depending on which day I run the script. Something in Date::Calc? Some other module? Thanks.
Back to
Seekers of Perl Wisdom
|
|