Example to use Weekday and YearDay function
Weekday returns the day of the week specified by t. 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.
Example
package main
import (
"fmt"
"time"
)
func main() {
t,_ := time.Parse("2006 01 02 15 04", "2015 11 11 16 50")
fmt.Println(t.YearDay()) // 315
fmt.Println(t.Weekday()) // Wednesday
t,_ = time.Parse("2006 01 02 15 04", "2011 01 01 0 00")
fmt.Println(t.YearDay())
fmt.Println(t.Weekday())
}
Output
315
Wednesday
1
Saturday