{"id":1266,"date":"2020-01-31T18:24:50","date_gmt":"2020-01-31T18:24:50","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=1266"},"modified":"2020-01-31T18:26:25","modified_gmt":"2020-01-31T18:26:25","slug":"convert-time-timezones-go","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/convert-time-timezones-go\/","title":{"rendered":"Convert time between different timezones in Go (Golang)"},"content":{"rendered":"\n

Every time.Time<\/strong> object has an associated location<\/strong> value. When you change the location of any time.Time<\/strong> object to any other location, then that instant of time is not changed. Only the location<\/strong> value associated with that time changes. The location<\/strong> associated with the time.Time object only has a presentation or display logic. <\/p>\n\n\n\n

The In<\/strong> function can be used to change the location<\/strong> associated with a particular time.Time<\/strong> object. Whenever the In<\/strong> function is called on any time.Time<\/strong> object (say t) then, <\/p>\n\n\n\n