Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Day/Date Modification

by gam3 (Curate)
on Aug 23, 2007 at 11:34 UTC ( [id://634615]=note: print w/replies, xml ) Need Help??


in reply to Day/Date Modification

Here is a solution that uses a different Package, Date::Manip.
use strict; use Date::Manip; my $arg = shift || ""; my $start; my $end; if (my ($day, $hours) = ($arg =~ m!^(\w{3})/(\d+)!)) { my $err; my $start = ParseDate($day); die "Bad day $day" unless $start; print UnixDate($start, "%u"), "\n"; $end = DateCalc($start,"+ $hours hours", \$err); print UnixDate($end, "%u"), "\n"; } else { die( "Error: use an argument of dow/hours (e.g. Sat/36)" ); }
-- gam3
A picture is worth a thousand words, but takes 200K.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-25 00:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found