In Go language, time packages supplies functionality for determining as well as viewing time. The Time.YearDay() function in Go language is used to find the day of the year as provided by “t”. Where, the range for non-leap years is [1, 365] and for leap years it is [1, 366]. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:func (t Time) YearDay() int
Here, “t” is the stated time.
Return value: It returns the day of the year as specified by “t”.
The day of the year in the 't' specified is: 156
The day of the year in the 't' specified is: 365
Here, the “t” stated above has values that are out of usual range but they are normalized while conversion.