Skip to content

Instantly share code, notes, and snippets.

@devlights
Created November 7, 2019 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devlights/1d2c1e29a1e6b924da8d6746487e3291 to your computer and use it in GitHub Desktop.
Save devlights/1d2c1e29a1e6b924da8d6746487e3291 to your computer and use it in GitHub Desktop.
Golang time format with RFC3339 (UTC, JST)
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)
}
@devlights
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment