Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/time manipulation - please repost solution. 1

Status
Not open for further replies.

gawker

Programmer
Feb 21, 2002
34
US
Last week, somebody was kind enough to post a snippet of PERL code on how to take a date/time value and subtract from it to get a date/time of (example) 10 minutes ago.

My post on this question was deleted before I got to copy the response. [sad]

Would that kind soul please repost his/her answer? I would greatly appreciate it.

Thanks again!

gawker

[atom]

 
#----subtract one hour (3600 seconds) from time
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 3600);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')

touch $STAMP file1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top