in reply to Find time after current time

Date calculations can be surprisingly tricky.

Pop quiz: What time do you get when you add 2 seconds to 03:59:59 pm on 31/12/2005 in the PST timezone? Let's find out:

use DateTime; my $dt = DateTime->new( year => 2005, month => 12, day => 31, hour => 15, minute => 59, second => 59, time_zone => "America/Los_Angeles", ); $dt->add(seconds => 2); print "$dt\n";
Result is 2005-12-31T16:00:00 since there was a leap second in between.