Windows Daylight Saving Time

Is there an easy way on Windows (using Delphi, not .NET) to convert UTC to local time with daylight saving time adjustments.

Data is returned for 12 years, so at this time it is necessary to take into account changes in the start and end dates of summer time.

+2
source share
3 answers

A funny, very similar question came up yesterday on LinkedIn.

This is the answer I gave there:

Time zones are somewhat fluid, especially during daylight saving time.

This database ( http://en.wikipedia.org/wiki/Tz_database ) defines time zones, and this sometimes changes, so you need an update mechanism.

There is a .NET implementation that you can wrap or use as a base: http://www.codeproject.com/KB/locale/zoneinfo_dotnet_api.aspx

I'm not sure how relevant this is Delphi implementation: http://sourceforge.net/projects/delphitz/

Let us know your final implementation.

Edit: The project mentioned above seems empty, so I searched further and found that

+2
source

Windows does not store historical data, you will need to use a database such as tz database . I could not find any Delphi code shown on this particular page, but it could be floating. Otherwise, you will have to migrate it from one of the supported languages ​​...

+2
source

How about: Convert UTC string to TDatetime in Delphi

In addition, there are some discussions and Delphi code for this: http://www.tek-tips.com/viewthread.cfm?qid=1486209&page=1

And you can find a fair bit on this with a google search: utc local delphi

0
source

Source: https://habr.com/ru/post/915317/


All Articles