time.Now() Function in Golang With Examples Last Updated : 21 Apr, 2020 Comments Improve Suggest changes Like Article Like Report In Go language, time packages supplies functionality for determining as well as viewing time. The Now() function in Go language is used to find the current local time. Moreover, this function is defined under the time package. Here, you need to import the "time" package in order to use these functions. Syntax: func Now() Time Return Value: It returns the current local time. Example 1: C // Golang program to illustrate the usage of // time.Now() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Calling Now() method tm := time.Now() // Prints current // local time in UTC fmt.Printf("%s", tm) } Output: 2020-04-09 11:24:14.785868848 +0000 UTC m=+0.000187421 Here, current time is returned in UTC. Example 2: C // Golang program to illustrate the usage of // time.Now() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Calling Now() method tm := time.Now() tm1 := time.Now() // Prints current local time in UTC fmt.Printf("%s\n", tm) // Sleep for 10 seconds time.Sleep(10 * time.Second) // Prints the current time after 10 // seconds of the sleep is over fmt.Printf("%s", tm1) } Output: 2020-04-09 11:37:59.087484568 +0000 UTC m=+0.000106559 2020-04-09 11:37:59.087484779 +0000 UTC m=+0.000106736 Comment More infoAdvertise with us Next Article time.Now() Function in Golang With Examples N nidhi1352singh Follow Improve Article Tags : Go Language GoLang-time Similar Reads time.Since() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Since() function in Go language holds time value and is used to evaluate the difference with the actual time. Moreover, this function is defined under the time package. Here, you need to import the "tim 2 min read time.Round() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Round() function in Go language is used to find the outcome of rounding the stated duration 'd' to the closest multiple of 'm' duration. Here, the rounding manner for middle values is to round far off f 2 min read time.String() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The String() function in Go language is used to find a string that represents the duration formats as "24h6m0.7s". Here, the foremost zero units are deleted. And the stated duration with less than one-secon 2 min read time.Tick() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Tick() function in Go language is a utility wrapper for NewTicker function. It only allows access to the ticking channel. In addition, Tick is beneficial for clients who don't require to shut down the T 3 min read time.NewTimer() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The NewTimer() function in Go language is used to create a new Timer that will transmit the actual time on its channel at least after duration "d". Moreover, this function is defined under the time package. 2 min read Like