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() {
timezone := timezonemapper.LatLngToTimezoneString(39.9254474,116.3870752)
fmt.Printf("Timezone: %s\n", timezone)
loc, _ := time.LoadLocation(timezone)
t, _ :=time.ParseInLocation("2006-01-02 15:04:05", "2010-01-01 00:00:00", loc)
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.