Go: Day of week
returns returns the day of the week of a
func (t Time) Weekday() Weekday
weekday := time.Now().Weekday() fmt.Println(weekday) // "Tuesday" fmt.Println(int(weekday)) // "2"
time.Weekday type specifies a day of the week (Sunday = 0, …).
type Weekday int const ( Sunday Weekday = iota Monday Tuesday Wednesday Thursday Friday Saturday )
Be the first to comment!