I have a time.Time value obtained from time.Now() and I want to get another time which is exactly 1 month ago.
time.Time
time.Now()
I know subtracting is possible
You can negate a time.Duration:
time.Duration
then := now.Add(- dur)
You can even compare a time.Duration against 0:
0
if dur > 0 { dur = - dur } then := now.Add(dur)
You can see a working example at http://play.golang.org/p/ml7svlL4eW