Skip to content

标准库

字数
141 字
阅读时间
1 分钟

fmt

errors

math

os

reflect

runtime

slices

strconv

strings

sync

time

由于一些国家会有冬夏令时的问题,机器的 Location 会改变,时区就可能从 UTC+2 变成 UTC+1。所以需要使用带时区的常量,如` time.

go
t.Format(time.RFC3339) // RFC3339 等价于 "2006-01-02T15:04:05Z07:00"。结果 2014-04-15T18:00:15-07:00
t1, _ := time.Parse(time.RFC3339, "2012-11-01T22:08:41+00:00")

json

interface 接收 int64 会导致精度丢失。建议用字符串传输,或者序列化时指定 decoder.UseNumber ,或选择如 jsonx 来序列化。

贡献者

页面历史


总访问量 次, 访客数 人次