用:
loc := time.FixedZone("UTC+11", +11*60*60)然后设置到此位置:
t = t.In(loc)
试试这个:
package mainimport ( "fmt" "time")func main() { loc := time.FixedZone("UTC+11", +11*60*60) t := time.Now() fmt.Println(t) fmt.Println(t.Location()) t = t.In(loc) fmt.Println(t) fmt.Println(t.Location()) fmt.Println(t.UTC()) fmt.Println(t.Location())}输出:
2009-11-10 23:00:00 +0000 UTC m=+0.000000001UTC2009-11-11 10:00:00 +1100 UTC+11UTC+112009-11-10 23:00:00 +0000 UTCUTC+11



