timezone

package
v0.60.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

timezone is a static list of timezones. It is incomplete as of now. Eventually it will be autogenerated using the approach as shown https://stackoverflow.com/questions/40120056/get-a-list-of-valid-time-zones-in-go

https://stackoverflow.com/questions/61186388/user-friendly-time-zone-names-corresponding-to-iana-names

Index

Constants

View Source
const (
	TimezoneAmericaChicago    = "America/Chicago"
	TimezoneAmericaLosAngeles = "America/Los_Angeles"
)
View Source
const (
	DefaultZoneDirsString = "/usr/share/zoneinfo/,/usr/share/lib/zoneinfo/,/usr/lib/locale/TZ/"
	PortableZones         = `` /* 10049-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func DefaultZoneDirs

func DefaultZoneDirs() []string

func LoadLocationByAbbreviation added in v0.40.7

func LoadLocationByAbbreviation(tzAbbr, tzName string) (*time.Location, error)

LoadLocationByAbbreviation returns a `*time.Location` given a timezone abbreviation and name. For example: ("PST", "Pacific Standard Time"). If the abbreviation only represents one timezone the timezone name can be omitted. An error is returned if more than one location is present. This is a wrapper for `github.com/tkuchiki/go-timezone` which defines the timezone abbreviation and names.

func LoadLocationsByAbbreviation added in v0.40.7

func LoadLocationsByAbbreviation(tzAbbr, tzName string) []*time.Location

LoadLocationsByAbbreviation loads all the matching locations by timezone abbreviation and name. Errors are returned as an empty slice.

func ZoneOffsetSeconds

func ZoneOffsetSeconds(dt time.Time, ianaTimeZoneName string) (int, error)

ZoneOffsetSeconds is used like ZoneOffsetSeconds(time.Now(), "America/New_York")

func ZonesPortable

func ZonesPortable() []string

func ZonesSystem

func ZonesSystem(zoneDirs []string) []string

GetZones treturns a list of timezones.

Types

This section is empty.

Directories

Path Synopsis
examples
build_constants
main this code was sourced from Stack Overflow here: https://stackoverflow.com/a/40130882/1908967
main this code was sourced from Stack Overflow here: https://stackoverflow.com/a/40130882/1908967

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL