HPE 9000 and HPE e3000 Servers
1827284 Members
3567 Online
109717 Solutions
New Discussion

Are there any date functions on server. Need to write script to generate datestamp.

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Are there any date functions on server. Need to write script to generate datestamp.

I'm writing a script where I need a date generate capability where I can get yesterdays or a previous or future date returned. Any ideas.

jack...
4 REPLIES 4
Ron Kinner
Honored Contributor
Solution

Re: Are there any date functions on server. Need to write script to generate datestamp.

I assume you are running on a unix platform. Try:
http://unix.about.com/library/weekly/aa070901a.htm

She gives separate scripts for the yesterday, tomorrow, add days and subtract days.

Ron
Sanjay_6
Honored Contributor

Re: Are there any date functions on server. Need to write script to generate datestamp.

A. Clay Stephenson
Acclaimed Contributor

Re: Are there any date functions on server. Need to write script to generate datestamp.

Hi Jack:

I'ver attached my latest version and it should solve almost any problem you want.

e.g.

3 days previous
XDAY=$(caljd.sh $(caljd.sh -p 3))

5 days from now UNLESS that falls on a weekend then skip to the next day)

XDAY=$(caljd.sh $(caljd.sh -n 5 -x 0 -x 6))

Same as above except skip holidays.
XDAY=$(caljd.sh $(caljd.sh -n 5 -x 0 -x 6 -h))

Tomorrow in YYYY-MM-DD output format
XDAY=$(caljd.sh -S '-' -y) $(caljd.sh -n 1))

You can do a caljd.sh -u for full usage.

Enjoy, Clay
If it ain't broke, I can fix that.
Jack C. Mahaffey
Super Advisor

Re: Are there any date functions on server. Need to write script to generate datestamp.

I love this place :)... Thanks... jack...