Get Hours in Duration
Examples in
Go
Hours returns the duration as a floating point number of hours.
package main
import (
"fmt"
"time"
)
func main() {
h, _ := time.ParseDuration("4h30m")
fmt.Printf("I've got %.1f hours of work left.", h.Hours())
}
Last Run
:
I've got 4.5 hours of work left.