How to get time duration between two human readable time stamp in Unix?

Here is two time I have:

Jul 12 16:02:01
Jul 13 01:02:01

and how can I do a simple match to get difference between two time which is 09:00:00

Thanks in advance.

Assuming you have GNU date available:

$ s=$(( $(date -d "Jul 13 01:02:01" +%s) - $(date -d "Jul 12 16:02:01" +%s) ))
$ printf "%02d:%02d:%02d\n" $((s/3600)) $((s%3600/60)) $((s%60))
09:00:00
3 Likes

Awesome!!!:b::b::b::b:
Thanks a lot

Which OS are you on?