Back to godoc.org
zgo.at/tz

Package tz

v0.0.0 (aeba38d)
Latest Go to latest
Published: May 20, 2020 | License: MIT | Module: zgo.at/tz

Overview

Package tz contains timezone lists.

Index

Package Files

Variables

var UTC = &Zone{CountryCode: "", Zone: "UTC", Abbr: "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.

type Zone

type Zone struct {
	*time.Location

	CountryCode string // ID
	Zone        string // Asia/Makassar
	Abbr        string // WITA
	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

func MustNew(ccode, zone string) *Zone

MustNew behaves like New(), but will panic on errors.

func New

func New(ccode, zone string) (*Zone, error)

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

func (t *Zone) Display() string

Display a human-readable description of the timezone, for e.g. <option>.

func (*Zone) Loc

func (t *Zone) Loc() *time.Location

Loc gets the time.Location, or UTC if it's not set.

func (Zone) MarshalText

func (t Zone) MarshalText() ([]byte, error)

MarshalText converts the data to a human readable representation.

func (*Zone) Offset

func (t *Zone) Offset() int

Offset gets the timezone offset in minutes.

func (*Zone) OffsetDisplay

func (t *Zone) OffsetDisplay() string

OffsetDisplay gets the offset as a human readable string.

For example "UTC +8:00", "UTC -7:30", "UTC").

func (*Zone) OffsetRFC3339

func (t *Zone) OffsetRFC3339() string

OffsetRFC3339 gets the offset as a RFC3339 string.

For example "+08:00", "-07:30", "UTC".

func (*Zone) Scan

func (t *Zone) Scan(v interface{}) error

Scan converts the data returned from the DB into the struct.

func (*Zone) String

func (t *Zone) String() string

String is an unique representation for this timezone.

func (*Zone) UnmarshalText

func (t *Zone) UnmarshalText(v []byte) error

UnmarshalText parses text in to the Go data structure.

func (Zone) Value

func (t Zone) Value() (driver.Value, error)

Value implements the SQL Value function to determine what to store in the DB.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier