in reply to Getting yesterday's date, and random dates in the past
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";
--
brian d foy <brian@stonehenge.com>
brian d foy <brian@stonehenge.com>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Getting yesterday's date, and random dates in the past
by fglock (Vicar) on Apr 02, 2005 at 03:11 UTC |
In Section
Seekers of Perl Wisdom