Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Englishy Date Translations

by fglock (Vicar)
on Jul 15, 2002 at 19:55 UTC ( [id://181895]=note: print w/replies, xml ) Need Help??


in reply to Englishy Date Translations

Date::Tie can do the math part:

use strict; use Date::Tie; tie my %date, "Date::Tie"; # 3rd Sunday in March $date{month} = 3; # march is 3 $date{day} = 1; # start counting form march first $date{weekday} = 7; # monday is 1, sunday is 7 $date{week} += 2; # advance 2 weeks print "3rd Sunday in March is $date{month}-$date{day}\n"; # 2nd Friday in April $date{month} = 4; # april is 4 $date{day} = 1; # start counting form april first $date{weekday} = 5; # monday is 1, friday is 5 $date{week} += 1; # advance 1 week print "2nd Friday in April is $date{month}-$date{day}\n";

Output:

3rd Sunday in March is 03-17 2nd Friday in April is 04-12

update: Date::Tie is fast

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found