Find Time difference in Unix

Hi,

START_TIME :- "10-NOV-2009 00:00:04"
STOP_TIME :- "10-NOV-2009 00:05:47"

Please help to find difference between these two.

Searched for the same topic but did not find an answer for the same time format :frowning:

Regards,
Robin

Have a look at the FAQ article: http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html

You may well find what you're looking for in here. Also, post what you have attempted, and where you are stuck, and it is likely that you will get some assistance.

HTH

Thanks a lot for your replay..

I have two variables

START_TIME="10-NOV-2009 00:00:04"
STOP_TIME="10-NOV-2009 00:05:47"

And now i need the difference in seconds in a third variable.

TIME_DIFFERENCE=$($START_TIME - $STOP_TIME)

so here i need the TIME_DIFFERENCE :slight_smile:

Can u help?

Regards,
Robin

With GNU date

$ date -d "10-NOV-2009 00:00:04" +%s
1257771604

$ date -d "10-NOV-2009 00:05:47" +%s
1257771947