Home > Article > Backend Development > Golang determines what day it is today
Golang’s method of getting the day of the week the current time is:
package main import ( "fmt" "time" ) func main() { //时间戳 t := time.Now() fmt.Println(t.Weekday().String()) }
time.Now(): Returns the current time.
t.Weekday().String(): Returns the current day of the week.
For more golang knowledge, please pay attention to the golang tutorial column.
The above is the detailed content of Golang determines what day it is today. For more information, please follow other related articles on the PHP Chinese website!