Standard library / time

time.Time.Location()

Return the location used to interpret the time's calendar fields. Expected stdout: 'UTC\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Location() *Location

Return Value

*Location

Return the location used to interpret the time's calendar fields.

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().Location()) }
Go Reference