VBA的日期节省时间的两个日期之间的小时数差异
由于节目节省了时间的变化,上周日有23个小时。结果,我的一些日常计算是不正确的,因为它们是用24小时的假设制成的。
我找不到计算这23小时的方法(在冬季变化的情况下为25)。
Last Sunday had 23 hours due to the daylight saving time change. As a result some of my daily calculations are incorrect because they are made with an assumption of 24 hours.
I cannot find the method to calculate those 23 hours (25 in the case of the winter time change).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在我的项目中使用时区函数
biaSwindowstimezone
github :vba.timezone-windows
(Module
wtzicore
)以获取开始时开始的偏差值和最终时间。然后,将偏差值添加到日期值并计算小时差:时区必须是您的字面意义,如 Windows注册表,例如
w。欧洲
(还可以检索并列出这些代码),使用您的周日日期,您将获得23小时:You can use the timezone function
BiasWindowsTimezone
in my project at GitHub:VBA.Timezone-Windows
(module
WtziCore
) to obtain the bias values for the start and the end time taking DST in account. Then, add the bias values to both date values and calculate the difference in hours:The timezone must be the literal of yours as found in the Windows Registry, for example
W. Europe
(there is code as well to retrieve and list these), and using your Sunday date, you will get 23 hours:这将在3月27日返回23小时,并在10月30日的时间变化中返回25小时。
This returns 23h for March 27th and 25h for Oct 30th dates of the time change.