package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Printf("now %v \n type %t\n", now, now)
fmt.Printf("年=%v\n", now.Year())
fmt.Printf("月=%v\n", now.Month())
fmt.Printf("月=%v\n", int(now.Month()))
fmt.Printf("日=%v\n", now.Day())
fmt.Printf("時=%v\n", now.Hour())
fmt.Printf("分=%v\n", now.Minute())
fmt.Printf("秒=%v\n", now.Second())
fmt.Println(now.Format("20060102150405"))
fmt.Println(now.Format("2006-01-02"))
fmt.Println(now.Format("15:04:05"))
fmt.Println(now.Format("01"))
fmt.Printf("Unix時間戳%v,UnixNano 納秒%v", now.Unix(), now.UnixNano())
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結