Skip to content

Instantly share code, notes, and snippets.

@alissonbrunosa
Last active October 30, 2020 11:18
Show Gist options
  • Save alissonbrunosa/29e95256e83fd2d74983ac91654724cc to your computer and use it in GitHub Desktop.
Save alissonbrunosa/29e95256e83fd2d74983ac91654724cc to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
func main() {
today := time.Now()
future := today.AddDate(0, 4, 0)
fmt.Println("Today:", today)
fmt.Println("Future:", future)
fmt.Println("Difference in days:", future.Sub(today).Hours()/24)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment