title: Calculate number of days between two dates?
body: <p>How can I calculate the number of days between two dates?  In the code below I should get the number of hours, which means that I should only need to divide by 24.  However, the result I get is something like <strong>-44929.000000</strong>.  I'm only looking a day or two back so I would expect 24 or 48 hours.</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "time"
  )
  
  func main() {
      timeFormat := "2006-01-02"
  
      t, _ := time.Parse(timeFormat, "2014-12-28")
      fmt.Println(t)
      //  duration := time.Since(t)
      duration := time.Now().Sub(t)
      fmt.Printf("%f", duration.Hours())
  }
  </code></pre>
  
  <p>Here's the executable Go code: <a href="http://play.golang.org/p/1MV6wnLVKh">http://play.golang.org/p/1MV6wnLVKh</a></p>