Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Created June 18, 2020 06:40
Show Gist options
  • Save heiwa4126/c1fd4383f622044aa601739ad5fba45b to your computer and use it in GitHub Desktop.
Save heiwa4126/c1fd4383f622044aa601739ad5fba45b to your computer and use it in GitHub Desktop.
Golangでローカル時間とUTC。あとstrptime()
package main
import (
"fmt"
"time"
)
func main() {
TF := `2006-01-02 15:04:05.999 -0700`
t := time.Unix(0, 0)
fmt.Printf("localtime: %s\n", t.Format(TF))
fmt.Printf("UTC: %s\n", t.In(time.UTC).Format(TF))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment