YYYY-MM-DD in Golang

Published: Thursday, Apr 16, 2015 Last modified: Monday, Dec 9, 2024

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)
}