Historical daylight savings in Windows
Is there a easy way in Windows (using Delphi, not .NET) to convert UTC times to a local time, with daylight saving adjustments.
Data goes back 12 years, so needs to take account of changes in DST start/end dates over that time.
Funny, a very similar question appeared yesterday on LinkedIn.
This is the answer I gave there:
Time Zones are somewhat fluid, especially when Daylight Saving Time starts/finishes.
This database ( http://en.wikipedia.org/wiki/Tz_database ) defines the time zones, and it changes sometimes, so you need an update mechanism as well.
There is a .NET implementation that you could wrap, or use as a base: http://www.codeproject.com/KB/locale/zoneinfo_dotnet_api.aspx
I'm not sure how up to date this Delphi implementation is: http://sourceforge.net/projects/delphitz/
Let us know your final implementation.
Edit: The project mentioned above seems empty, so I searched further and found the Delphi TimeZone Database project to be still active.
--jeroen
Windows does not store historical data, you will need to use a database such as the tz database. I couldn't find any Delphi code listed on that particular page, but there might be some floating around. Otherwise, you'll have to port it from one of the languages that are currently supported...
How about: Convert UTC string to TDatetime in Delphi
Also, there is some discussion and Delphi code for doing this at: http://www.tek-tips.com/viewthread.cfm?qid=1486209&page=1
And you can find a fair bit on this with a Google search for: utc local delphi
链接地址: http://www.djcxy.com/p/29400.html上一篇: gettime()和夏令时
下一篇: Windows中的历史夏令时