golang time "string" or "unix"

t1 := time.Now().Format("20060102")
    t2 := "20170417000000"
    fmt.Println(t1, t2)
    fmt.Println(t1 > t2)

    t3, err := time.Parse("20060102", "20170423")
    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(t3.Unix())
    fmt.Println(t3.UnixNano() / 1000000)

    tl, err := time.LoadLocation("Local")
    if err != nil {
        fmt.Println(err)
    }

    t4, err := time.ParseInLocation("20060102", "20170423", tl)
    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(t4.Unix())
    fmt.Println(t4.UnixNano() / 1000000)

你可能感兴趣的:(golang time "string" or "unix")