Standard library / time

time.FixedZone()

Create a location with a constant offset in seconds east of UTC, without daylight-saving transitions. Expected stdout: '1970-01-01T02:00:00+02:00\n'.

Formal Syntax & Structure

go syntaxgo
func FixedZone(name string, offset int) *Location

Parameters & Attributes

NameTypeDescription
namestringLocation name.
offsetintSigned seconds east of UTC.

Return Value

*Location

Create a location with a constant offset in seconds east of UTC, without daylight-saving transitions.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func main() {  loc := time.FixedZone("Plus2", 7200)  fmt.Println(time.Unix(0, 0).In(loc).Format(time.RFC3339))}
Go Reference