We can find some lists of the UTC time offsets, showing the difference in hours and minutes from Coordinated Universal Time (UTC), from the westernmost (−12:00) to the easternmost (+14:00).

In general, we save datetime using iso8601 format.

However - by default - we just includes some countries and regions. And it is not very accurate. For instance, UTC+01:00 is for Paris, Rome, Stockholm, Tunis, even if those cities are not exactly on the same longitude...

I would like to be able to find the true UTC time offset from a geolocation, in order to have a local time based on the position of the sun in the sky.

I mean, instead of having UTC+01:00 near the Eiffel Tower at the geolocation 48.858844300000001,2.2943506 I would prefer to have UTC+01:13 for example.

How could we do, having a geolocation such as 48.352845300000001,40.9943506, to get the true UTC time offset?

Thank you for any ideas.

有帮助吗?

解决方案

I've never heard of the phrase 'true UTC', but I understand what you are asking. You could calculate the longitude distance between the user's position and the closest UTC longitude line, and then use that to determine your fractional hour offset.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top