YYYY-MM-DD in Golang

Published: Thursday, Apr 16, 2015 Last modified: Thursday, Nov 14, 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)
}