How to Subtract time.Duration from time in Go
To subtract time.Duration from time.Time value in Golang, you can use the Add() method with a negative duration. The AddDate() function is not suitable for subtracting a time.Duration from a time.Time value because it works with years, months, and days, not durations like hours, minutes, or seconds. package main import ( “fmt” “time” ) func … Read more