Operating System - HP-UX
1848310 Members
7822 Online
104024 Solutions
New Discussion

Date and Julian Date on HP-UX 10.20

 
SOLVED
Go to solution
Thirumalai Ulaganathan
Occasional Advisor

Date and Julian Date on HP-UX 10.20

I would like to know the following things.

1. How to see Yesterday date on HP-UX 10.20. Is there any scripts available to see back dates?.

2. How to see Julian date.

Thanks,

Thirumalai
3 REPLIES 3
Pete Ellis
Trusted Contributor
Solution

Re: Date and Julian Date on HP-UX 10.20

1. set your TZ variable to plus 24. I'm in GMT0BST so the 0 becomes 24, not sure what happens if your zone is not zero.

2. there are a numbe rof links for this, see: http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xea948cc5e03fd6118fff0090279cd0f9,00.html
Robert-Jan Goossens
Honored Contributor

Re: Date and Julian Date on HP-UX 10.20

Hi,

take a look at next link, the famous script from A. Clay Stephenson

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5a8d93e260b0d611abdb0090277a778c,00.html

Robert-Jan.
James R. Ferguson
Acclaimed Contributor

Re: Date and Julian Date on HP-UX 10.20

The use of the following is commonly seen to compute tomorrow's date:

# TZ=GMT-24 date +%m/%d/%y

...and "correspondingly", yesterdays's date"

# TZ=GMT+24 date +%m/%d/%y

Eurpopeans,living around the Prime Meridian are the "lucky" ones who can use +-24 hours to exactly compute yesterday or tommorrow *including* the correct time.

As noted by the man pages for environ(5), the offset is the value that must be added to local time to arrive at UTC (GMT). The offset takes the format hh[:mm[:ss]] where(hh)is any value from 0 through 23. The optional minutes (mm) and seconds (ss) fields are a value from 0 through 59. The hour field is required. If offset is preceded by a -, the time zone is east of the Prime Meridian. A + preceding offset indicates that the time is one that is west of the Prime Meridian.

For example, it is now about 1221 hours on March 11 in the Eastern US. To produce a date *and time* exactly 24-hours from now, I would need to compute an offset of (24-5) to account for the difference in my timezone (EST) and UTC time.

Notice that I cannot produce an exact date and time for yesterday, however, since to affect this, the computation would need to offset 29 hours (24+5), an invalid offset.

You are advised to beware.

Regards!

...JRF...