Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Yesterday Date

by ForgotPasswordAgain (Deacon)
on Feb 04, 2008 at 19:37 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://666066]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2018-03-19 05:43 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (232 votes). Check out past polls.