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

Golang determines what day it is today

Release: 2019-12-31 09:34:17
Original
7360 people have browsed it

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())

}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template