time.Time.Minute() Function in Golang With Examples
Last Updated :
21 Apr, 2020
In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Minute() function in Go language is used to find the minute offset within the stated hour that is provided by “t” and the range is [0, 59]. 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) Minute() int
Here, “t” is the stated time.
Return Value: It returns the minute offset within the stated hour that is provided by “t”.
Example 1:
package main
import "fmt"
import "time"
func main() {
t := time .Date(2019, 6, 5, 11,
35, 04, 0, time .UTC)
min := t.Minute()
fmt.Printf( "The stated minute within" +
" the hour specified is: %v\n" , min)
}
|
Output:
The stated minute within the hour specified is: 35
Example 2:
package main
import "fmt"
import "time"
func main() {
t := time .Date(2019, 6, 5,
11, 91, 04, 0, time .UTC)
min := t.Minute()
fmt.Printf( "The stated minute within" +
" the hour specified is: %v\n" , min)
}
|
Output:
The stated minute within the hour specified is: 31
Here, the stated minute is out of usual range but it is normalized while conversion.
Share your thoughts in the comments
Please Login to comment...