This might get you pointed in the right direction -> https://stackoverflow.com/questions...tion-using-latitude-and-longitude-coordinatesHi all
How can I use the GNSS library to obtain the time in another country, taking into account the time in my country based on latitude and longitude?
OK - so if you know what the time is based on the current longitude of the device (from the device's clock & GPS position) & you know the relationship between longitude & time, you should be able to calculate the time at another longitude via something like:Thank you, Computersmith64 for help, but it seems that the existing solutions depend on the use of the Internet, and some users of my application have weak Internet connections for long periods of time, so I decided to calculate the time difference based on latitude and longitude, as each longitude represents a difference of 4 minutes. I want a solution based on this idea.
Actually, that link I gave you has a heap of offline options too - maybe you didn't read down the list far enough.I am afraid that there are factors other than the difference between longitude and latitude. The solution must be based on the time zone. I am looking for a way to find the time zone without referring to the Internet or the user’s device, only via GPS.
I found some JSON files that could do the trick at that link, but if there are no exact matching values then rounding might be a problem, so I decided that a solution using sites that provide the time difference was a must.Actually, that link I gave you has a heap of offline options too - maybe you didn't read down the list far enough.
I suppose you could just create a database with all the global timezones & their relative boundary coordinates. Out of interest, do you have any ideas yourself?
- Colin.
I've also found mathematical formulas that do a similar job.Long time ago I made a solution, but can't find it now.
Take a picture of world time zones, like this :
View attachment 149515
Clear all the legends so there are only colored areas.
Create a transformation from lat long to the pixel on the map.
Read the color of the pixel , use it as a key in a map object to get the time zone. You have to color some zones so there are no similar colors.
Certainly, but it seems that the only practical solution is to use ready-made online services.@khwarizmi The only thing you can calculate from Lat/Long is Local Mean Time (LMT) based on Longitude offset from UTC..... That is midday when the sun reaches it's zenith at any point on the earth. LMT is only useful for calculating Sunrise/Sunset and other nautical/celestial events.
Some countries have adopted local time offsets from GMT in one hour steps, some X hours and 30 mins, some X hours and 15 minutes. Many countries adopt Daylight Savings Time in winter, but the dates vary between countries. Some countries do not change the clocks at all. China, for instance, spans 60°+ of longitude which gives a LMT span of 4 hours, yet observes GMT+8 across the whole country all year round. (1 hour LMT change = 15° of longitude)
There is probably a database somewhere where you can query a Lat/Long position and find out what country you are in. You could compile a database of countries with their GMT offsets and DST changing dates but as countries vary their DST dates all the time, keeping the database maintained would be a nightmare!
I take your point about internet availability but to me the Google Time Zone API seems like the only workable solution.
Time Zone API
Yeah, I remember a similar discussion, pretty sure in this forum, maybe a year or two ago. Will look for it now. Wish me luck. ?Long time ago I made a solution, but can't find it now.
Effectively that map image is a visual table to translate latitude-longitude points to timezones, with about 230,000 entries.Take a picture of world time zones, like this :
I am afraid you are correct, if you need exact correctness, eg:I am afraid that there are factors other than the difference between longitude and latitude.
who dreamed up this line?!?!
phone does not have a sim card. Went from CST to PST and it does not pick up the new time zone w/GPS on
it would be significant data for the phone to hold to get it correct w/o internet access. And still quite a bit to get it even close.
# The International Date Line
# From Gwillim Law (2000-01-03):
#
# The International Date Line is not defined by any international standard,
# convention, or treaty. Mapmakers are free to draw it as they please.
# Reputable mapmakers will simply ensure that every point of land appears on
# the correct side of the IDL, according to the date legally observed there.
#
# When Kiribati adopted a uniform date in 1995, thereby moving the Phoenix and
# Line Islands to the west side of the IDL (or, if you prefer, moving the IDL
# to the east side of the Phoenix and Line Islands), I suppose that most
# mapmakers redrew the IDL following the boundary of Kiribati. Even that line
# has a rather arbitrary nature. The straight-line boundaries between Pacific
# island nations that are shown on many maps are based on an international
# convention, but are not legally binding national borders.... The date is
# governed by the IDL; therefore, even on the high seas, there may be some
# places as late as fourteen hours later than UTC. And, since the IDL is not
# an international standard, there are some places on the high seas where the
# correct date is ambiguous.
The size of the data file is massive (1.6GB)
It might be useful to bear in mind that the ticks Long value returned by DateTime.Now is the same everywhere around the world at the same time.sit for the electronic exam at the same time
I'm not sure how your process could electronically enforce and audit the "exam at the same time" requirement, without an internet connection.some users of my application have weak Internet connections for long periods of time