Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Yesterday Date

by ForgotPasswordAgain (Priest)
on Feb 04, 2008 at 19:37 UTC ( [id://666066]=note: print w/replies, xml ) Need Help??


in reply to Yesterday Date

There's probably an equivalent with DateTime, but it always takes me too long to figure out, so I end up using Date::Manip :

use Date::Manip; ... $date = Date_PrevWorkDay($date,$off [,$time]);

Replies are listed 'Best First'.
Re^2: Yesterday Date
by Herkum (Parson) on Feb 05, 2008 at 03:56 UTC
    How can DateTime be too hard to figure out? Come on!
    use DateTime; my $date = DateTime->new( month => 2, day => 4, year => 2008 ); print "Start Date: " . $date->mdy . "\n"; $date->subtract( days => 1); print "Yesterday's Date: " . $date->mdy . "\n"; while( $date->day_of_week > 5) { $date->subtract( days => 1); } print "Next weekday date is " . $date->mdy() . "\n";

    See! Easy as pie, a cow pie even! :)

Re^2: Yesterday Date
by Anonymous Monk on Feb 04, 2008 at 19:51 UTC
    How could one use this?
    Would that be that the $date is today's date, what would $off be, and $time be?
      For an explanation of how to use an installed module, for example, Date::Manip
      perldoc date::manip
      for any of the other modules, substitute the name of your selection.
        perldoc date::manip
        That's a broken example. If you're going to use an example, use a proper one:
        localhost:~ % perldoc date::manip No documentation found for "date::manip". localhost:~ % perldoc Date::Manip [page shown]
        It's case sensitive.
Re^2: Yesterday Date
by kp2a (Sexton) on Feb 06, 2008 at 01:47 UTC
    I recommend Date::Manip does everything but wash windows! One package to install, one to learn.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found