Skip to contentSkip to conversation

comparing dates

DISCUSSION urgrue 4 participants 4 messages Oct 10, 2003 – Oct 11, 2003

lore
Share & tools
lore

urgrue

author
#0 lore raw

anyone know an easy way to compare dates and display the difference? difference doesnt have to be in date format, in fact it would be even easier if it was just one unit, like "total diff in seconds" or nanoseconds or whatever, doesnt matter.

#1 lore raw

* urgrue <[email protected]> wrote on 10/Oct/2003 - 11:54:08 :

Quoted 4 lines

anyone know an easy way to compare dates and display the difference? difference doesnt have to be in date format, in fact it would be even easier if it was just one unit, like "total diff in seconds" or nanoseconds or whatever, doesnt matter.

If you are comfortable with Perl you could use Date::Calc

http://search.cpan.org/~stbey/Date-Calc-5.3/Calc.pod

It does a great job with everything involving dates ...

Greetz
Stefan

#3 lore raw
In reply to urgrue
Quoted 4 lines · urgrue

anyone know an easy way to compare dates and display the difference? difference doesnt have to be in date format, in fact it would be even easier if it was just one unit, like "total diff in seconds" or nanoseconds or whatever, doesnt matter.

see options -d and %s in date's man page

Signature · 1 line
Never trust anybody whose arm is bigger than your leg.
#2 lore raw
In reply to Stefan Wimmer
Quoted 5 lines · Stefan Wimmer

* urgrue <[email protected]> wrote on 10/Oct/2003 - 11:54:08 :

Quoted 4 lines

anyone know an easy way to compare dates and display the difference? difference doesnt have to be in date format, in fact it would be even easier if it was just one unit, like "total diff in seconds" or nanoseconds or whatever, doesnt matter.

Sys admin published an article on date handling via shell, perl (and some other option) recently. All the code they discussed is available on their site. You would have to search for it, as I don't have the url handy.

Google for SysAdmin

-chuck

Signature · 7 lines
ACCEL Services, Inc.| Specialists in Gravity, Magnetics |  1(713)993-0671 ph.
 2401 Fountain View |   and Integrated Interpretation   |  1(713)993-0608 fax
     Suite 320      |                                   |
 Houston, TX, 77057 |          Chuck Campbell           | [email protected]
                    |  President & Senior Geoscientist  |

     "Integration means more than having all the maps at the same scale!"