package tz
import "zgo.at/tz"
Package tz contains timezone lists.
Index ¶
- Variables
- type Zone
- func MustNew(ccode, zone string) *Zone
- func New(ccode, zone string) (*Zone, error)
- func (t *Zone) Display() string
- func (t *Zone) Loc() *time.Location
- func (t Zone) MarshalText() ([]byte, error)
- func (t *Zone) Offset() int
- func (t *Zone) OffsetDisplay() string
- func (t *Zone) OffsetRFC3339() string
- func (t *Zone) Scan(v any) error
- func (t *Zone) String() string
- func (t *Zone) UnmarshalText(v []byte) error
- func (t Zone) Value() (driver.Value, error)
Variables ¶
var UTC = &Zone{CountryCode: "", Zone: "UTC", Abbr: []string{"UTC"}, CountryName: "UTC", Comments: "", Location: time.UTC}
UTC timezone.
var Zones = []*Zone{ /* 429 elements not displayed */ }
Zones is a list of all timezones by country.
Types ¶
type Zone ¶
type Zone struct { *time.Location CountryCode string // ID Zone string // Asia/Makassar Abbr []string // WITA – the correct abbreviation may change depending on the time of year (i.e. CET and CEST, depending on DST). CountryName string // Indonesia Comments string // Borneo (east, south); Sulawesi/Celebes, Bali, Nusa Tengarra; Timor (west) // contains filtered or unexported fields }
Zone represents a time zone.
func MustNew ¶
MustNew behaves like New(), but will panic on errors.
func New ¶
New timezone from country code and zone name. The country code is only informative, and may be blank or wrong, in which case it will load the first zone found.
func (*Zone) Display ¶
Display a human-readable description of the timezone, for e.g. <option>.
func (*Zone) Loc ¶
Loc gets the time.Location, or UTC if it's not set.
func (Zone) MarshalText ¶
MarshalText converts the data to a human readable representation.
func (*Zone) Offset ¶
Offset gets the timezone offset in minutes.
func (*Zone) OffsetDisplay ¶
OffsetDisplay gets the offset as a human readable string: "UTC +8:00", "UTC -7:30", "UTC".
Note that this displays the offset that is currently valid. For example Europe/Berlin may be +0100 or +0200, depending on whether DST is in effect.
func (*Zone) OffsetRFC3339 ¶
OffsetRFC3339 gets the offset as a RFC3339 string: "+08:00", "-07:30", "UTC".
Note that this displays the offset that is currently valid. For example Europe/Berlin may be +0100 or +0200, depending on whether DST is in effect.
func (*Zone) Scan ¶
Scan converts the data returned from the DB into the struct.
func (*Zone) String ¶
String is an unique representation for this timezone.
func (*Zone) UnmarshalText ¶
UnmarshalText parses text in to the Go data structure.
func (Zone) Value ¶
Value implements the SQL Value function to determine what to store in the DB.
Source Files ¶
alias.go list.go tz.go
- Version
- v0.0.0-20240819050900-3c7bf6122612 (latest)
- Published
- Aug 19, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 2 weeks ago –
Tools for package owners.