Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Golang set timezone for time example
package main
import (
"fmt"
"time"
)
func main() {
loc, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
panic(err)
}
now := time.Now().In(loc)
fmt.Println(now.String()) // 2009-11-10 15:00:00 -0800 PST
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.