Standard library / time
time.Time.YearDay()
Return the one-based day of the year (1–365 or 366). Expected stdout: '60\n'.
Formal Syntax & Structure
go syntaxgo
func (t Time) YearDay() intReturn Value
int
Return the one-based day of the year (1–365 or 366).
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() { fmt.Println(fixed().YearDay()) }