Golang time.Time.AddDate() function example
package time
Golang time.Time.AddDate() function usage example
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println("Today : ", now.Format(time.ANSIC))
addDates := now.AddDate(1, 0, 0)
fmt.Println("After 1 year : ", addDates.Format(time.ANSIC))
}
Sample output :
Today : Mon Aug 3 15:42:17 2015
After 1 year : Wed Aug 3 15:42:17 2016
Reference :
Advertisement
Something interesting
Tutorials
+9.5k Mac OSX : Get a process/daemon status information
+25.9k Golang : How to read integer value from standard input ?
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+5.8k CodeIgniter/PHP : Remove empty lines above RSS or ATOM xml tag
+6.1k nginx : force all pages to be SSL
+11.7k Golang : Secure file deletion with wipe example
+13.9k Golang : Get current time
+11k Golang : Create S3 bucket with official aws-sdk-go package
+12.8k Golang : http.Get example
+11.3k Golang : Intercept and process UNIX signals example
+5.9k Golang : Extract unicode string from another unicode string example
+14.5k Golang : How to check if your program is running in a terminal