I'm trying to add a number of days (actually a number of weeks) to an existing date in Go. I have tried
myDate.Add(time.Hour * 24 * 7 * weeksToAdd)
But I get an error when I try to build: invalid operation: time.Hour * startAdd (mismatched types time.Duration and float64)
So weeksToAdd
is currently a float64
, but I can change it to an int or whatever. Changing it to an int only changed my error to say that int
and Duration
can't be multiplied.
How do I add days to a date?
question from:https://stackoverflow.com/questions/32998110/add-days-to-date-in-go