import (
"fmt"
"time"
)
func main() {
p := fmt.Println
// 2015-11-30 19:18:48.264366857 +0800 CST
now := time.Now()
p(now)
// 返回time.Time
// 2009-11-17 20:34:58.651387237 +0000 UTC
then := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
p(then)
// 2009
p(then.Year())
// November
p(then.Month())
// 17
p(then.Day())
// 20
p(then.Hour())
// 34
p(then.Minute())
// 58
p(then.Second())
// 651387237
p(then.Nanosecond())
// UTC
p(then.Location())
// Tuesday
p(then.Weekday())
// true
p(then.Before(now))
// false
p(then.After(now))
// false
p(then.Equal(now))
// 52886h48m22.514729668s
diff := now.Sub(then)
p(diff)
p(diff.Hours())
p(diff.Minutes())
p(diff.Seconds())
p(diff.Nanoseconds())
// 2015-11-30 11:23:21.166116905 +0000 UTC
p(then.Add(diff))
// 2003-11-06 05:46:36.136657569 +0000 UTC
p(then.Add(-diff))
now := time.Now()
secs := now.Unix()
nanos := now.UnixNano()
fmt.Println(now)
p(t.Format("3:04PM"))
p(t.Format("Mon Jan _2 15:04:05 2006"))
p(t.Format("2006-01-02T15:04:05.999999-07:00"))
p(t.Format("2006-01-02 15:04:05"))
form := "3 04 PM"
t2, _ := time.Parse(form, "8 41 PM")
p(t2)
fmt.Printf("%d-%02d-%02dT%02d:%02d:%02d-00:00\n",
t.Year(), t.Month(), t.Day(),
t.Hour(), t.Minute(), t.Second())
}
我在想,是不是应该取消 关注这个网站了? ??
感觉这个网站永远长不大呀???
要不就是一些月经贴隔三差五就祭出来恶心你???
要不就是一些陈年旧货车轱辘一样残渣泛起???
#1