Last active
August 29, 2015 13:55
-
-
Save techslides/8758929 to your computer and use it in GitHub Desktop.
Martini Render FuncMap Function to Convert Unix timestamp into nice Date format to be used in a template file
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
| m.Use(render.Renderer(render.Options{ | |
| Funcs: []template.FuncMap{ | |
| { | |
| "formatTime": func(args ...interface{}) string { | |
| t1 := time.Unix(args[0].(int64), 0) | |
| return t1.Format(time.Stamp) | |
| }, | |
| })) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Learn more about this code here: http://techslides.com/simple-app-with-go-martini-gorp-and-mysql/