Discussion Locked

Date comparison in AIX 5

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

what is the best way to perform comparison on dates for comparison in AIX 5.
e.g.
typeset -i lastrundate=050131
adding 7 to this would be 050138 (need it to be 050207 or this will compute to less than 050201)

[[ (${lastrundate} + 7) -ge ${currentdate} ]]

3 replies

by gary_w

lastrundate is really an integer, not a date. You need to do date math (which will allow for leap years, wrapping around months, etc.

Check this link out for a korn shell version:
http://www.samag.com/documents/s=8284/sam0307b/0307b.htm

There is a typo in the get_greg_from_JD function. there is an errant 'm' which it seems can be deleted from this line:
J=$((80*L/2447)m)

There are some perl scripts out there too if you do a little searching.

Gary

This discussion is closed to new replies.