From the course: Go Recipes: Practical Projects
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Time - Go Tutorial
From the course: Go Recipes: Practical Projects
Solution: Time
(upbeat music) - Here's the solution. First we load the time zone that we want to convert from. And then we load the time zone that we want to convert to using the load location function Next, we are going to convert the string into a time value, using the parse in location function we have in the time auto Now we have the time and the from time is a time in the time in the from time zone. And now we can use the in method to convert the time to the time in the times on that we want. And finally, we need to convert the time back to a string using the dot format method.