I have two time strings; eg. "09:11" and "17:22" on the same day (format is hh:mm). How do I calculate the time difference in minutes between these two?
Can the standard date
library do this?
Example:
#!/bin/bash
MPHR=60 # Minutes per hour.
CURRENT=$(date -u -d '2007-09-01 17:30:24' '+%F %T.%N %Z')
TARGET=$(date -u -d'2007-12-25 12:30:00' '+%F %T.%N %Z')
MINUTES=$(( $(diff) / $MPHR ))
Is there a simpler way of doing this given the hour and minute in hh:mm