Created
April 12, 2019 13:40
-
-
Save dherbst/c5813d8467cd6d984443e97c95e775e7 to your computer and use it in GitHub Desktop.
Golang time in a location
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" | |
) | |
const PolicyDateFormat = "02-01-2006 15:04:05" | |
func main() { | |
location, err := time.LoadLocation("Europe/London") | |
if err != nil { | |
fmt.Printf("NewToken: error getting Europe/London time location err=%v\n", err) | |
return | |
} | |
d := time.Now().In(location) | |
fmt.Printf("%s\n", d.Format(PolicyDateFormat)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment