In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Date() function in Go language is used to check the year, month, and day in which the stated “t” presents itself. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
func (t Time) Date() (year int, month Month, day int)
Here, “t” is the stated time.
Return Value: It returns year, month and day of the stated “t”.
The stated year is: 2020 The stated month is: May The stated day is: 6
The stated year is: 2021 The stated month is: February The stated day is: 3
Here, the stated month and day are out of usual range but they are normalized while conversion.