I think this will do the trick:
use strict;
use Time::Local;
my $time = timelocal(localtime);
$time -= (60 * 60 * 24); # subtract one day
my ($s, $min, $h, $d, $mon, $y, $w, $yd, $isdst) = localtime($time);
printf("Yesterday's date: %02d:%02d:%02d-%04d/%02d/%02d\n",
$h, $min, $s, $y+1900, $mon+1, $d);
The trick is to work in Epoch seconds, and let localtime
figure out what the date is.
Jeff
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
|