go 时间

2018-02-28  本文已影响9人  seven_son

常用api

time:=time.Now()
then := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
    p(then.Year())
    p(then.Month())
    p(then.Day())
    p(then.Hour())
    p(then.Minute())
    p(then.Second())
    p(then.Nanosecond())
    p(then.Location())
  p(then.Weekday())
    p(then.Before(now))
    p(then.After(now))
    p(then.Equal(now))
    diff := now.Sub(then)
    p(diff)
    p(diff.Hours())
    p(diff.Minutes())
    p(diff.Seconds())
    p(diff.Nanoseconds())
p(then.Add(diff))
p(then.Add(-diff))
上一篇 下一篇

猜你喜欢

热点阅读