Last active
February 27, 2022 20:12
-
-
Save nidhi-canopas/81c3358b646813b016512353881ef68f to your computer and use it in GitHub Desktop.
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
| import ( | |
| "time" | |
| "fmt" | |
| ) | |
| func main() { | |
| timeZone := "Asia/Kolkata" // timezone value | |
| loc, _ := time.LoadLocation(timeZone) | |
| currentTime = time.Now().In(loc) | |
| fmt.Println("currentTime : ", currentTime) | |
| } | |
| output: | |
| // for timezone = "Asia/Kolkata" | |
| currentTime : 2022-02-09 10:42:39.164079505 +0530 IST | |
| // for timezone = "Asia/Shanghai" | |
| currentTime : 2022-02-09 13:14:33.986953939 +0800 CST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment