Get Day Offset within Year in Go

Posted by yhuang
Public (Editable by Users)

YearDay returns the day of the year specified by t, in the range [1,365] for non-leap years, and [1,366] in leap years.

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {

	now := time.Now()
	fmt.Println(now.YearDay())
}