Golang: timestamp add not working

the task is this, I need to add 5 minutes to the timestamp, but whatever I do, the time does not change, what am I doing wrong?

Example:

1 Answer

The call to parse.Add at line 12 in your example should be changed to something like:

parse=parse.Add(5 * time.Minute)

the .Add method doesn't alter the time struct in place, it returns a new struct with the duration added which your original example was throwing away.

See this GO webiste for a quick example:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like