tzdata

package module
v0.0.0-...-154dc28 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 5 Imported by: 0

README

GoDoc

tzdata

Embeddable timezone database for Go projects

Build

go get -d github.com/bcicen/tzdata && \
cd ${GOPATH}/github.com/bcicen/tzdata && \
go generate

Usage

Once the timezone data is built, it may be used in place of time.LoadLocation():

package main

import (
	"fmt"
	"time"

	"github.com/bcicen/tzdata"
)

func main() {
	loc, _ := tzdata.Load("America/New_York")
	fmt.Println(time.Now().In(loc))
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Built = ""
	// LocationNames contains all available timezone names
	LocationNames = allLocations()
)

Functions

func Load

func Load(name string) (*time.Location, error)

Load a timezone Location by name from the embedded tz database

func Preload

func Preload()

Uncompress and load all timezone data into memory for quicker access

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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