Created
June 11, 2020 16:48
-
-
Save 178inaba/074e995bd06c96b6501899dbb7e17250 to your computer and use it in GitHub Desktop.
UTC to JST(Asia/Tokyo) in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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