YYYY-MM-DD in Golang

Published: Thursday, Apr 16, 2015 Last modified: Wednesday, Feb 24, 2021

http://play.golang.org/p/HnU4YjTA4b

package main

import (
	"fmt"
	"time"
)

func main() {
	t := time.Now().Local()
	s := t.Format("2006-01-02")
	fmt.Println(t, "=>", s)
}