1832511 Members
4719 Online
110043 Solutions
New Discussion

time stamp

 
Michael_33
Regular Advisor

time stamp

Hi all,

How to get the yesterday's time stamp using shell(csh better)?

thx!
4 REPLIES 4
Rajeev  Shukla
Honored Contributor

Re: time stamp

Hi
Have a look at this thread

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=223926

You'll see ways with perl and a C program i have posted.

Cheers
Rajeev
Michael_33
Regular Advisor

Re: time stamp

any other idea?
V.Tamilvanan
Honored Contributor

Re: time stamp

Dave La Mar
Honored Contributor

Re: time stamp

Michael -
There are a multitude of ways to do this.
i.e
TZ=PST8PDT+24 date "+%b %d %H:%m" | read var
var will be twenty four hours ago now.
In the above format, if you wish to time stamp a file then:
touch -t $var your_file_name

Or -

use $var to name the file with a time stamp extension.
The format of var can be changed in many ways by changing the date "+%" portion.

We are on the US West cost, so you TZ may not be PST etc, but it will work on your TZ setting as well.
And of course there is good old A.Clay's hammer.

Best of luck.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."