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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIX date comparisons

Status
Not open for further replies.

makill

Technical User
May 7, 2002
1
US
I need to compare two date fields against each other in UNIX and I can't find how to do this...can anyone help?
 
Hi:

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.

Regards,


Ed
Schaefer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top