time.Hours() 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 Hours() function in Go language is used to find the duration of time in the form of a floating-point number of hours. 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 (d Duration) Hours() float64 Here, d is the duration of time. Return value: It returns the duration as float64. Example 1: C // Golang program to illustrate the usage of // Hours() function // Including main package package main // Importing fmt and time import ( "fmt" "time" ) // Calling main func main() { // Defining duration of Hours method hr, _ := time.ParseDuration("3h25m") // Prints duration as // floating point number fmt.Printf("Only %.1f hours of task is"+ " remaining.", hr.Hours()) } Output: Only 3.4 hours of task is remaining. Example 2: C // Golang program to illustrate the usage of // Hours() function // Including main package package main // Importing fmt and time import ( "fmt" "time" ) // Calling main func main() { // Defining duration of Hours method hr, _ := time.ParseDuration("3h25m1200s6543356ms") // Prints duration as // floating point number fmt.Printf("Only %.1f hours of "+ "task is remaining.", hr.Hours()) } Output: Only 5.6 hours of task is remaining. Comment More infoAdvertise with us Next Article time.Hours() Function in Golang With Examples nidhi1352singh Follow Improve Article Tags : Go Language GoLang-time Similar Reads time.Time.Hour() Function in Golang With Examples The Time.Hour() function in Go language is used to check the hour within the day in which the stated "t" presents itself in the range [0, 23]. 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 (t Time) 2 min read time.Now() Function in Golang With Examples 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 functio 2 min read 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.Unix() Function in Golang with Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Unix() function in Go language is used to yield the local time which is related to the stated Unix time from January 1, 1970, in UTC. Moreover, this function is defined under the time package. Here, you 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.Date() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Date() function in Go language is used to find Date the Time which is equivalent to yyyy-mm-dd hh:mm:ss + nsec nanoseconds in the proper time zone in the stated location. Moreover, this function is defi 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.Minutes() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Minutes() function in Go language is used to find the duration of time in the form of a floating-point number of minutes. Moreover, this function is defined under the time package. Here, you need to imp 2 min read time.Until() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Until() function in Go language holds time value t and is used to evaluate the duration until the time t. Moreover, this function is defined under the time package. Here, you need to import the "time" p 2 min read Like