Skip to content

Instantly share code, notes, and snippets.

@ik5
Created October 11, 2016 14:36
Show Gist options
  • Save ik5/5a10aa55ab7d3f7deaa5e0f2e1d2776d to your computer and use it in GitHub Desktop.
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"
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