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)
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
Duration can’t be multiplied.
How do I add days to a date?