title: How to calculate number of business days in Golang
body: <p>I have this so far to count the number of days using <a href="http://golang.org/pkg/time/" rel="nofollow noreferrer">http://golang.org/pkg/time/</a> but I don't know how to exclude weekends and only count business days.</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "time"
  )
  
  func main() {
      t := time.Now()
      f := time.Date(2015, time.August, 21, 24, 0, 0, 0, time.UTC)
      diff := f.Sub(t)
  
      // convert diff to days
      days := int(diff.Hours() / 24)
  
      fmt.Printf("days  %d\n", days)
  }
  </code></pre>