Created
March 29, 2021 16:12
-
-
Save krishbhanushali/b29ab7b3e818d25f728c1c51f087e18f 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
| package main | |
| import ( | |
| "text/template" | |
| "os" | |
| "log" | |
| "time" | |
| ) | |
| func main() { | |
| time := time.Now() | |
| const timeTemplate = `{{(.).Format "02 Jan 2006 15:04:05 MST"}}` | |
| t := template.Must(template.New("timeTest").Parse(timeTemplate)) | |
| err := t.Execute(os.Stdout, time) | |
| if err != nil { | |
| log.Println(err.Error()) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment