package main import ( "fmt" "time" ) // 24小时制 https://www.zhihu.com/question/366830553 const LAYOUT = "2006-01-02 15:04:05" func main() { // 获取当前日期 now := time.Now() fmt.Printf(now.Format(LAYOUT)) // 2022-08-31 09:48:40 }
package main import ( "fmt" "time" ) // 24小时制 https://www.zhihu.com/question/366830553 const LAYOUT = "2006-01-02 15:04:05" func main() { // 获取当前日期 now := time.Now() fmt.Printf(now.Format(LAYOUT)) // 2022-08-31 09:48:40 }