Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to compare 2 dates of yyyymmdd format in a if statement?

Status
Not open for further replies.

RajShekar

Programmer
May 27, 2004
14
0
0
US
How to compare 2 dates of yyyymmdd format in a if statement?
I am trying to compare two dates in a If condition like this and it does not work?

if (( "$PROC_DATE" < "$MONTHS_DATE" ))

then

print "$MONTHS_DATE"

fi
 
Something like this ?
[ "$PROC_DATE" -lt "$MONTHS_DATE" ] && print "$MONTHS_DATE"

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top