Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created February 26, 2015 08:06
Show Gist options
  • Select an option

  • Save kaneshin/018ada079327be183f50 to your computer and use it in GitHub Desktop.

Select an option

Save kaneshin/018ada079327be183f50 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "time"
func main() {
from := 21
to := 24
// For Condition
truncate := 24 * time.Hour
fromDate := time.Now().AddDate(-to, 0, 1).Truncate(truncate)
toDate := time.Now().AddDate(-from, 0, 0).Truncate(truncate).Add(-1)
fmt.Println(fromDate, "<= x <=", toDate)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment