Skip to content

dcarbone/lazytz-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lazytz-go

Little repo to help bridge the gap between lazy time zone offset providers and golang.

Installation

go get -u github.com/dcarbone/lazytz-go

Usage

package main

import (
	"fmt"
	"os"

	"github.com/dcarbone/lazytz-go"
)

func main() {
	if len(os.Args) < 1 {
		fmt.Println("Must provide timezone abbreviation as first argument.")
		os.Exit(1)
	}

	abbr := os.Args[1]
	
	info, ok := lazytz.Get(abbr)
	if !ok {
		fmt.Printf("No timezone registered with abbreviation %q\n", abbr)
		fmt.Println("Current list:")
		fmt.Println(lazytz.GetAbbreviations())
		os.Exit(1)
    }
	
	fmt.Println("Timezone info:")
	fmt.Println(info)
}

About

Little repo to help bridge the gap between lazy time zone offset providers and golang.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages