you cannot compare MMDDYYYY,
but YYYYMMDD vs YYYYMMDD
loock around, there are a lot of threads playing
with split&&formating strings, computing date...
echo 07/20/04|sed -e 's/\(.*\)\/\(.*\)\/\(.*\)/\3\1\2/'
will transform 07/20/04 to 040720
and 040720 is now comparable to 040728
BUT this assume the input is exactly xx/xx/xx
the sed works, what if input is: 1/1/2004 vs 12/31/04
so:
- carefully check the input
- translate it to comparable strings
- compare the values
For more advanced date manipulation, check out this thread, in which I posted KornShell functions for converting to and from Julian days (not to be confused with Julian dates, there's a link to an explanation).
Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
This has been answered a few times already see thread822-845095 it's worth having a look in the unix scripting forum as loads of these types of questions have already been asked
Mike
"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.