Standard library / time

time.Time.Second()

Return second within the minute (0–59); Go's calendar ignores leap seconds. Expected stdout: '56\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Second() int

Return Value

int

Return second within the minute (0–59); Go's calendar ignores leap seconds.

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()            { fmt.Println(fixed().Second()) }
Go Reference