note
mmartin
Ok, so I was able to figure this out.<br>
<br>
So I used the same exact formula from my OP and did the total seconds into the past minus 'time'.<br>
<br>
This was almost exactly what I wanted, but no matter what I put for a length into the past the <br>
output was ALWAYS showing 4 Hours off from what it should have been...<br>
<br>
<br>
I then realized that I should have been using "localtime()" instead of "gmtime()". I switched them<br>
up and now its working like a charm!!<br>
<br>
<br>
Here's how to do it if anyone ever gets stuck trying to calculate a Date AND Time into the past:<br>
<br>
<br>
<b>For Example --> I want "2 Days, 12 Hours, 1 Minute, and 20 Seconds" into the past...</b><br>
<br>
<b>From my Linux CMD Prompt:</b> FYI... The integer '216080' is the total seconds into the past<br>
<br>
<i><b>### This will print the date and Time in a readable format (i.e. mm/dd/yyy hh:mm:ss in 24-Hour Format)...</b></i><br>
perl -e 'use POSIX 'strftime'; $_n_days_ago = strftime("%m/%d/%Y %T", localtime( time-216080 )); print "$_n_days_ago\n"'<br>
<br>
<i><b>### Now what I wanted for MY output is (i.e. "$seconds, $minutes, $hours, $mday, $month, $year")</b></i><br>
# I wanted it like this so I could get the UNIX Timestamp of that Past Date and Time by using those values from its output...<br>
perl -e 'use POSIX 'strftime'; $_n_days_ago = strftime("%S, %M, %k, %d, %m, %Y", localtime( time-216080 )); print "$_n_days_ago\n"'<br>
<br>
<br>
Thanks,<br>
Matt<br>
<br>
<br>
994059
994059