golang时间格式化

package main
func main(){

        fmt.Println(time.Now().Format("2006"))
	fmt.Println(time.Now().Format("2006-01"))
	fmt.Println(time.Now().Format("2006-01-02"))
	fmt.Println(time.Now().Format("2006-01-02 15"))
	fmt.Println(time.Now().Format("2006-01-02 15:04"))
	fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
	fmt.Println(time.Now().Format("2006-01-02 15:04:05.000"))
	fmt.Println(time.Now().Format("20060102150405000"))
	fmt.Println(time.Now().Format("2006-01-02 15:04:05Z07:00"))

}

猜你喜欢

转载自liguanfeng.iteye.com/blog/2296100