Standard library / time
time.Time.Date()
Return calendar year, month and day in the associated location. Expected stdout: '2024 February 29\n'.
Formal Syntax & Structure
go syntaxgo
func (t Time) Date() (year int, month Month, day int)Return Value
(year int, month Month, day int)
Return calendar year, month and day in the associated location.
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func fixed() time.Time { return time.Date(2024, 2, 29, 12, 34, 56, 123000000, time.UTC) }func main() { y, m, d := fixed().Date(); fmt.Println(y, m, d) }