HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

find time half hour ago from now

 
DeafFrog
Valued Contributor

find time half hour ago from now

Dear Gurus ,

i need to find the time half hour ago from system time , like if system time is 8 past 15 , the the script should give 7 45 , if it 22 30 it should return 22 00.while googling forum i found clay's caljd.sh but could not use it to solve my problem.

Rgeards,
FrogIsDeaf
2 REPLIES
DeafFrog
Valued Contributor

Re: find time half hour ago from now

closing the post as i found the solution as :

perl -e '@d=localtime time()-1800; printf "%02d%02d%02d%02d\n", $d[4]+1,$d[3],$d[2],$d[1]'

Regards,
FrogIsDeaf
DeafFrog
Valued Contributor

Re: find time half hour ago from now

solution as stated above ,
regards,
FrogIsDeaf