Home >Backend Development >Golang >Golang determines what day it is today

Golang determines what day it is today

尚
Original
2019-12-31 09:34:177364browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn