|No such thing as a small change|
Use 'strftime' to calculate a date/time in the Past.by mmartin (Monk)
|on Sep 17, 2012 at 16:54 UTC||Need Help??|
mmartin has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to figure out a date/time in the past given I know it was 'a' days ago, 'b' hours ago, 'c' min ago and 'd' seconds ago.
I came across this perl command:
Which calculates the day "$DAYS_AGO" into the past. i.e. If "$DAYS_AGO = 2" then the resulting output would be "15" since today
is the 17th.
I've tried a couple different ways using a similar formatted command but it's not giving what I need.
I know the "FORMAT" part of the strftime function would be --> strftime( "%S, %M, %k, %d, %m, %Y",...
Which the resulting Output I want would be in the format:
"Seconds, Minutes, Hours, Day-of-Month, Month, Year"
If I want the date and time from, 2 days, 10 hours, 20 minutes, and 30 seconds Ago the output would be:
Could anyone tell me if this is possible using the functions above?
Any suggestions would be very much appreciated..!
Thanks in Advance,