Golang time.Time.Add() function example
package time
Golang time.Time.Add() function usage example
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println("Today : ", now.Format("Mon, Jan 2, 2006 at 3:04pm"))
fiveDays := time.Hour * 24 * 5
diff := now.Add(fiveDays)
fmt.Println("Five days from now will be : ", diff.Format(time.ANSIC))
}
Output :
Today : Mon, Aug 3, 2015 at 3:36pm
Five days from now will be : Sat Aug 8 15:36:43 2015
Reference :
Advertisement
Something interesting
Tutorials
+11.6k Swift : Convert (cast) Float to String
+6.3k Unix/Linux : Use netstat to find out IP addresses served by your website server
+8.2k Golang : Get final or effective URL with Request.URL example
+20.5k Golang : Pipe output from one os.Exec(shell command) to another command
+10.6k Golang : Simple File Server
+6.1k Golang : Get missing location after unmarshal binary and gob decode time.
+7.1k Golang : A simple forex opportunities scanner
+5.9k Facebook : How to force facebook to scrape latest URL link data?
+14.5k Golang : How to determine if user agent is a mobile device example
+22.7k Golang : Strings to lowercase and uppercase example
+13k Golang : Get terminal width and height example