Duration.Minutes in Go

Posted by GoDoc
Last Edited by yhuang
Public (Editable by Users)

Minutes returns the duration as a floating point number of minutes.

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {
	m, _ := time.ParseDuration("1h30m")
	fmt.Printf("The movie is %.0f minutes long.", m.Minutes())
}