I have 2 variables.
GMDCOMTM which stores the date time Tue Oct 1 13:32:40 2013
GMDRRSTM which stores the date time Tue Oct 2 23:35:33 2013
H
Convert dates to %s ---> seconds since 1970-01-01 00:00:00 UTC
.
$ date -d"Tue Oct 2 23:35:33 2013" "+%s"
1380749733
So the thing is to get the difference in seconds between both dates using bc
as calculator:
$ d1="Tue Oct 1 13:32:40 2013"
$ d2="Tue Oct 2 23:35:33 2013"
$ echo $(date -d"$d2" "+%s") - $(date -d"$d1" "+%s") | bc
122573
Then you can get it into hours, days, with the great function Stéphane Gimenez indicates in UNIX & Linux:
$ displaytime 122573
1 days 10 hours 2 minutes and 53 seconds