Skip to content

Instantly share code, notes, and snippets.

@otiai10
Created October 8, 2013 12:19
Show Gist options
  • Select an option

  • Save otiai10/6883806 to your computer and use it in GitHub Desktop.

Select an option

Save otiai10/6883806 to your computer and use it in GitHub Desktop.
1day before in golang
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Hello, 世界")
n := time.Now()
fmt.Printf("%v\n", n)
d,err := time.ParseDuration("24h")
fmt.Printf("%v\n", d)
fmt.Printf("%v\n", err)
before := n.Add(-d)
fmt.Printf("%v\n", before)
ts := before.Unix()
fmt.Printf("%v\n", ts)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment