xue35 / TCX.jl

TCX parses TCX/XML sports file.
MIT License
1 stars 2 forks source link

Use longtitude/latitude to get timezone and show local run start time #11

Open marcoziti opened 5 years ago

marcoziti commented 5 years ago

Library to use: https://github.com/pegler/pytzwhere

>>> from tzwhere import tzwhere
>>> tz = tzwhere.tzwhere()
>>> print(tz.tzNameAt(53.68193999999999, -6.239169999999998))
None

>>> from tzwhere import tzwhere
>>> tz = tzwhere.tzwhere(forceTZ=True)
>>> print(tz.tzNameAt(53.68193999999999, -6.239169999999998, forceTZ=True))
Europe/Dublin
julia> Pkg.add("TimeZones")

# Changing time zones
dt = DateTime(2015, 1, 1, 0)
zdt_utc = ZonedDateTime(dt, utc; from_utc=true)
zdt_warsaw = ZonedDateTime(dt, warsaw; from_utc=true)
marcoziti commented 5 years ago
>>> longitude = 121.52059
>>> latitude = 31.204181
>>> from timezonefinder import TimezoneFinder
>>> tf = TimezoneFinder()
>>> tf.timezone_at(lng=longitude, lat=latitude)
'Asia/Shanghai'