Standard library / time

time.Time.Local()

Return the same instant in time.Local, removing monotonic data. Output depends on local zone settings. Expected stdout: '13\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Local() Time

Return Value

Time

Return the same instant in time.Local, removing monotonic data.

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()            { time.Local = time.FixedZone("Office", 3600); fmt.Println(fixed().Local().Hour()) }
Go Reference