title: Bash script: difference in minutes between two times
body: <p>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? </p>
  
  <p>Can the standard <code>date</code> library do this?</p>
  
  <p>Example:</p>
  
  <pre><code>#!/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 ))
  </code></pre>
  
  <p>Is there a simpler way of doing this given the hour and minute in hh:mm</p>