Standard library / time

time.Time.Clock()

Return hour, minute and second in the associated location. Expected stdout: '12 34 56\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Clock() (hour, min, sec int)

Return Value

(hour, min, sec int)

Return hour, minute and second in the associated location.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func fixed() time.Time { return time.Date(2024, 2, 29, 12, 34, 56, 123000000, time.UTC) }func main()            { h, m, s := fixed().Clock(); fmt.Println(h, m, s) }
Go Reference