Created
October 11, 2016 14:36
-
-
Save ik5/5a10aa55ab7d3f7deaa5e0f2e1d2776d to your computer and use it in GitHub Desktop.
Example for using format and timezone to display current time in format of "dd/mm/yyyy hh:MM::ss TZ"
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() { | |
t := time.Now() | |
loc, err := time.LoadLocation("Asia/Jerusalem") | |
if err != nil { | |
fmt.Println("Opps: ", err) | |
return | |
} | |
fmt.Printf("Now: %+vs\n", t.In(loc).Format("02/01/2006 15:04:05 MST")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment