The DateTime module (as well as other Date modules) can add or subtract arbitrary time values.
#!/usr/bin/perl use DateTime; my $today = DateTime->now->truncate( to => 'day' ); my $yesterday = $today->subtract( days => 1 ); print "Today is $today\nYesterday was $yesterday\n";
In reply to Re: Getting yesterday's date, and random dates in the past
by brian_d_foy
in thread Getting yesterday's date, and random dates in the past
by mhearse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |