golang中如何输入当前时间
package main import( "fmt" "time" ) func main(){ t := time.Now() y,m,d := t.Date() today := time.Now().Format("2006-01-02") datetime := time.Now().Format("2006-01-02 15:04:05")//后面的参数是固定的 否则将无法正常输出 fmt.Println("time is : ",t ) fmt.Println("y m d is : ",y,m,d ) fmt.Println("now is :",today) fmt.Println("now is :",datetime) }
有疑问加站长微信联系(非本文作者)