Standard library / time
time.Duration.Seconds()
Express duration as floating-point seconds, possibly rounded by float64 representation. Expected stdout: '1.5\n'.
Formal Syntax & Structure
go syntaxgo
func (d Duration) Seconds() float64Return Value
float64
Express duration as floating-point seconds, possibly rounded by float64 representation.
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func main() { fmt.Println((1500 * time.Millisecond).Seconds()) }