Created
November 7, 2019 05:47
-
-
Save devlights/1d2c1e29a1e6b924da8d6746487e3291 to your computer and use it in GitHub Desktop.
Golang time format with RFC3339 (UTC, JST)
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() { | |
location := time.FixedZone("JST", 9*60*60) | |
now := time.Now() | |
jst := now.In(location) | |
nowFormat := now.Format(time.RFC3339) | |
jstFormat := jst.Format(time.RFC3339) | |
fmt.Printf("%v\n%v\n", nowFormat, jstFormat) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run https://play.golang.org/p/lEmTWLI97A0