Delphi:使用 XSDateTime 而不将时间转换为本地时区
我正在 Delphi 中编程并使用一个 API,该 API 返回代表约会时间段的 XSDateTime。当我尝试创建本地数据时间时,时间将转换为我的 EST 时区(Z-05:00 或 Z-04:00,具体取决于 DST)。我需要时间保留在 CST 的原始时区 (Z-06:00)。我目前正在按如下方式格式化时间:
aApptListing := FormatDateTime('yyyy/mm/dd t', aSlots[i].StartDateTime.AsDateTime);
其中 StartDateTime 为 CST 时间 (Z-06:00)。如何保留原来的 CST 时间?例如,如果通过 API 提供的日期/时间为“2011-12-25T08:00:00-06:00”,我想显示 12/25/2011 @ 8:00 AM,而不是 9:00 AM是美国东部时间。
I am programming in Delphi and consuming an API that returns an XSDateTime representing an appointment timeslot. When I try to create a local datatime the time is being converted to my EST timezone (Z-05:00 or Z-04:00 depending on DST). I need the time to remain in the original timezone of CST (Z-06:00). I am currently formatting the time as follows:
aApptListing := FormatDateTime('yyyy/mm/dd t', aSlots[i].StartDateTime.AsDateTime);
where StartDateTime comes in as the time in CST (Z-06:00). How can I keep the original time for CST? For instance, if the date/time comes thru the API as '2011-12-25T08:00:00-06:00' I want to show 12/25/2011 @ 8:00 AM, not 9:00 AM which would be EST.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来以下应该有效:
It looks like the following should work: