golang time

1 2 3 4 5 6 7
        
月日时分秒年时区
标准以这个对应
const (
    43        ANSIC       = "Mon Jan _2 15:04:05 2006"
    44        UnixDate    = "Mon Jan _2 15:04:05 MST 2006"
    45        RubyDate    = "Mon Jan 02 15:04:05 -0700 2006"
    46        RFC822      = "02 Jan 06 15:04 MST"
    47        RFC822Z     = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone
    48        RFC850      = "Monday, 02-Jan-06 15:04:05 MST"
    49        RFC1123     = "Mon, 02 Jan 2006 15:04:05 MST"
    50        RFC1123Z    = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone
    51        RFC3339     = "2006-01-02T15:04:05Z07:00"
    52        RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"
    53        Kitchen     = "3:04PM"
    54        // Handy time stamps.
    55        Stamp      = "Jan _2 15:04:05"
    56        StampMilli = "Jan _2 15:04:05.000"
    57        StampMicro = "Jan _2 15:04:05.000000"
    58        StampNano  = "Jan _2 15:04:05.000000000"
    59    )

包里面带了常用的标准

t, _ := time.Parse(withNanos, "2013-10-05 18:30:50")

用这个就能解析时间了

本文来自:博客园

感谢作者:ggaaooppeennngg

查看原文:golang time

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。