title: How to subtract two different date formats to get days in bash?
body: <p>I am working on bash. I have to subtract current date from a given date to get number of days as a difference. The given date is in format <em>m/d/yyyy</em> so instead of <strong>09/26/2015</strong> it is <strong>9/26/2015</strong>. So even if I try to convert both dates into same format and subtract it says invalid date format.</p>
  
  <pre><code>           date1=$(date +"%F")
             date2=$(date -d 11/2/2015 +"%F")
             diff=$(date "--date=${date2} -${date1}" +%F)
             echo $diff days remaining
  </code></pre>
  
  <p>This is what I had tried with some variations, but doesn't work. What am I doing wrong? Thanks in advance.</p>