通常在本地化时往往会涉及到时区转换的问题,而通常在真正关注到时区之前我们所「默认」使用的时区为 UTC 或“本地”。 本文以 Go 为例,分析下 Go 中的时区使用。 读取时区在 Go 中,读取时区使用的是 LoadLocation 函数。 12345678910111213141516// LoadLocation returns the Location with the given name...
本文基于 Go1.20.4 源码进行分析,更高或更低版本可能有所差异 概览:time.Time话不多说,先上源码 123456789101112131415161718192021222324252627// 为了减少文章长度突出重点,注释部分有所删改// A Time represents an instant in time with nanosecond precision.// // Th...