Adding hours, minutes, seconds to current time

How do I add hours, minutes, and seconds (defined as ints) to the current time, similar to AddDate ?

timein := time.Now().Local().AddDate(Hours, Mins, Sec)

but with hours, minutes, and seconds.

1 Like

I guess what you are looking for is

timein := time.Now().Local().Add(time.Hour * time.Duration(Hours) +
                                 time.Minute * time.Duration(Mins) +
                                 time.Second * time.Duration(Sec))

Refer: stackoverflow