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

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]);


Comment on Re: Yesterday Date
Download Code
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 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 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
Node Status?
node history
Node Type: note [id://666066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-12-23 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (134 votes), past polls