Skip to content

Instantly share code, notes, and snippets.

@krishbhanushali
Created March 29, 2021 16:12
Show Gist options
  • Select an option

  • Save krishbhanushali/b29ab7b3e818d25f728c1c51f087e18f to your computer and use it in GitHub Desktop.

Select an option

Save krishbhanushali/b29ab7b3e818d25f728c1c51f087e18f to your computer and use it in GitHub Desktop.
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