Get the current day of the week in Go using the time.Now().Weekday() method.
Use the time.Weekday method on a time.Time value to get the day of the week.
import "time"
day := time.Now().Weekday()
fmt.Println(day) // e.g., Monday
The Weekday() method returns a time.Weekday constant (e.g., time.Sunday, time.Monday) which can be compared directly or converted to a string using String().
Getting the day of the week in Go tells your program what day it is right now. It works like checking a calendar to see if today is Monday or Friday. You use it when you need to change your program's behavior based on the day, like sending a weekly report only on Sundays.