Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Date/Timestamp Puzzle

by Ido (Hermit)
on Jun 20, 2005 at 17:28 UTC ( [id://468422]=note: print w/replies, xml ) Need Help??


in reply to Date/Timestamp Puzzle

The "bug" you see is simply because months of gmtime and timegm are 0..11, and 31/11 is an invalid date (or rather, the same day as the 1/12??). You could simple you Date::Calc :

use Date::Calc 'Delta_Days'; print Delta_Days(2005,10,31,2005,11,1);

Replies are listed 'Best First'.
Re^2: Date/Timestamp Puzzle
by thundergnat (Deacon) on Jun 20, 2005 at 18:32 UTC

    I agree with you about Date::Calc but I think Date::Calc 'Add_Delta_Days' may be closer to what the OP is looking for. He has a date and wants to get the date of the following day.

    use warnings; use strict; use Date::Calc qw/Add_Delta_Days Today_and_Now/; my $delta = 1; my ($year, $month, $day) = Today_and_Now; print "$year $month $day\n"; my @nextdate = Add_Delta_Days($year, $month, $day, $delta); print "@nextdate\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-19 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found