我必须为ePrescribe开发一个应用程序,并且需要将UTC时间值(例如 2010-01-01T16:09:04.5Z)转换为本地时间。德尔福2010,有什么建议吗?
解决方案您必须首先手动解析字符串。从中提取单个值,然后可以将它们放入Win32 SYSTEMTIME 记录中,并调用 SystemTimeToTzSpecificLocalTime() 将其从UTC转换为本地。然后,您可以根据需要使用转换后的 SYSTEMTIME ,例如,使用TDateTime docwiki.embarcadero/Libraries/XE3/en/System.SysUtils.SystemTimeToDateTime rel = nofollow> SystemTimeToDateTime() 。
I have to develop an application for ePrescribe and need to convert an UTC Time value (for example '2010-01-01T16:09:04.5Z') to local time. Delphi 2010, any suggestions?
解决方案You have to parse the string manually first. Extract the individual values from it, then you can put them into a Win32 SYSTEMTIME record and call SystemTimeToTzSpecificLocalTime() to convert it from UTC to local. You can then use the converted SYSTEMTIME however you need, such as converting it to a TDateTime using SystemTimeToDateTime().
更多推荐
如何将UTC转换为当地时间
发布评论