简介:Golang:time模块获取当前日期并格式化输出 package mainimport ("fmt""time")// 24小时制 https://www.zhihu.com/question/366830553const LAYOUT = "2006-01-02 15:04:05"func main() {// 获取当前日期now := time.Now()fmt.Printf(now.Format(LAYOUT))// 2022-08-31 09:48:40}...
Golang:time模块获取当前日期并格式化输出 文档 https://go-zh.org/pkg/time/ packagemain import( "fmt" "time" ) // 24小时制 https://www.zhihu.com/question/366830553 constLAYOUT="2006-01-02 15:04:05" funcmain() { // 获取当前日期 now:=time.Now() fmt.Printf(now.Format(...
https://go-zh.org/pkg/time/ packagemainimport("fmt""time")// 24小时制 https://www.zhihu.com/question/366830553constLAYOUT="2006-01-02 15:04:05"funcmain(){// 获取当前日期now:=time.Now()fmt.Printf(now.Format(LAYOUT))// 2022-08-31 09:48:40} 需要注意的是:Golang的格式化字符串,并...