in reply to Use 'strftime' to calculate a date/time in the Past.
FWIW, I used
Time::Local for a one-liner:
Update: to get the day, date, and time 48 days ago:perl -MTime::Local=timelocal -e 'print scalar localtime timelocal qw(3 +0 40 2 15 8 2012)';
#!/usr/bin/perl -l use strict; use autodie; use warnings; use POSIX 'strftime'; use Time::Local 'timelocal'; my $days_ago = '48'; ($days_ago) = strftime("%d", gmtime( time - $days_ago * 86400 )); print scalar localtime timelocal( 30, 40, 2, $days_ago, 7, 2012, );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Use 'strftime' to calculate a date/time in the Past.
by Anonymous Monk on Sep 17, 2012 at 21:42 UTC |
In Section
Seekers of Perl Wisdom