Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created June 11, 2020 16:48
Show Gist options
  • Save 178inaba/074e995bd06c96b6501899dbb7e17250 to your computer and use it in GitHub Desktop.
Save 178inaba/074e995bd06c96b6501899dbb7e17250 to your computer and use it in GitHub Desktop.
UTC to JST(Asia/Tokyo) in Go
package main
import (
"fmt"
"time"
)
func main() {
time.Local = time.UTC
jstLoc := time.FixedZone("Asia/Tokyo", int(9*time.Hour/time.Second))
now := time.Now()
jstNow := now.In(jstLoc)
fmt.Println(now)
fmt.Println(jstNow)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment