Time.Date in Go

Posted by GoDoc
Public (Editable by Users)

Date returns the year, month, and day in which t occurs.

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {
	d := time.Date(2000, 2, 1, 12, 30, 0, 0, time.UTC)
	year, month, day := d.Date()

	fmt.Printf("year = %v\n", year)
	fmt.Printf("month = %v\n", month)
	fmt.Printf("day = %v\n", day)
}