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";