When comparing date and time in unix, I like to change to the number of seconds since the EPOCH. It's easier to compare two integers than two unix date strings. So how do you do this?
1) Over in the General Unix discussion forum, look at Mike Lacey's FAQ on finding yesterday's date. There's a Perl solution using the localtime function which. There's also a time zone, TZ, variable solution you might be able to use.
2) The GNU version of awk, gawk, has a strftime function which converts/formats date and time.
3) If you have the Tool Command Language, TCL, it also contains a clock function which might help.
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.