Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/philiphil/timezonemapper

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/philiphil/timezonemapper

  • v0.0.0-20221220091633-ad860fc086fe
  • Source
  • Go
  • Socket score

Version published
Created
Source

timezonemapper

Golang lib that converts from GPS coordinate latitude/longitude to timezone string.

Translated from java version, see https://github.com/drtimcooper/LatLongToTimezone .

Install

go get -u github.com/zsefvlol/timezonemapper

Usage

package main

import (
	"fmt"
	"github.com/zsefvlol/timezonemapper"
	"time"
)

func main() {
	// Get timezone string from lat/long
	timezone := timezonemapper.LatLngToTimezoneString(39.9254474,116.3870752)
	// Should print "Timezone: Asia/Shanghai"
	fmt.Printf("Timezone: %s\n", timezone)
	// Load location from timezone
	loc, _ := time.LoadLocation(timezone)
	// Parse time string with location
	t, _ :=time.ParseInLocation("2006-01-02 15:04:05", "2010-01-01 00:00:00", loc)
	// Should print
	// 2010-01-01 00:00:00 +0800 CST
	// 2009-12-31 16:00:00 +0000 UTC
	fmt.Println(t)
	fmt.Println(t.UTC())
}

Map update

Last updated at 2019.10.22

Will update (I guess) if the original project drtimcooper/LatLongToTimezone updates.

FAQs

Package last updated on 20 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc