in reply to Getting yesterday's date, and random dates in the past
Why not use the following? It only uses core functions and modules, and works irregardless of Daylight savings Time.
use Time::Local qw( timegm_nocheck ); sub get_yesterday { my ($date) = @_; my ($year, $month, $day) = split(/-/, $date); return sprintf("%d-%02d-%02d", (gmtime(timegm_nocheck(0, 0, 0, $day-1, month, $year)))[5, 4, 3] ); }
|
|---|