公历

发布于 2024-09-30 07:19:55 字数 131 浏览 10 评论 0原文

我在夏令时遇到了一个奇怪的问题。我有一个 java 程序计划在每天上午 00:05 运行,但昨天它在 23:05 运行。我正在使用公历在java中安排这个程序。在此之前,它从未在 23:05 运行过,除非有人手动运行它。有谁知道这是否是日历的问题?

I faced a weird problem with day light savings. I have a java program scheduled to run on every day on 00:05 AM time, but yesterday it ran on 23:05. I am using Gregorian calendar to schedule this program in java. It has never ran on 23:05 before this unless someone manually ran it. Does anyone know if this is issue with calendar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

转角预定愛 2024-10-07 07:19:55

这个问题几乎肯定与夏令时切换有关,但奇怪的是它应该在午夜左右发生,因为夏令时切换通常发生在凌晨 2 点。

如果不知道您的机器设置为哪个时区并查看您的实际代码,则很难说更多。

That issue is almost certainly related to the daylight savings time switch, though it is odd that it should occur around midnight since the DST switch typically happens at 2 AM.

It's hard to say more without knowing what time zone your machine is set to and seeing your actual code.

凹づ凸ル 2024-10-07 07:19:55

这不是和夏令时问题有关吗?前一天晚上,世界某些地区的时间从夏令时更改为冬令时。

Isn't it related to day-light saving issues? The previous night the time was changed from summer time to winter time in some parts of the world.

卖梦商人 2024-10-07 07:19:55

最好的猜测是,它运行在旧版本的 Java 上,并且它不恰当地认为美国夏令时是从周日早上开始的。

在内部,Java 将时间存储为 GMT 偏移量...具体来说,是自 1970 年 1 月 1 日 00:00:00.000 GMT 以来的毫秒数(记录在 Calendar 类的描述)。

如果您不想更新 Java 本身,您仍然可以使用 时区更新工具,用于更新系统上安装的 Java 时区。

注意:这应该在 Java 5u6 中得到修复,除非您位于 此列表

At a best guess, this is running on an older version of Java, and it inappropriately thought that Daylight Saving Time started Sunday morning in the US.

Internally, Java stores the time as a GMT offset... specifically, the number of milliseconds since January 1, 1970 00:00:00.000 GMT (documented in the Calendar class's description).

If you don't want to update Java itself, you can still use the Timezone Updater Tool to update the Java timezones installed on the system.

Note: This was supposedly fixed in Java 5u6, unless you're in one of the other time zones mentioned in this list.

傲影 2024-10-07 07:19:55

世界 DST 时间与北美 DST 时间有时不一致。

在欧洲,夏令时在十月的最后一个星期日发生变化。
http://en.wikipedia.org/wiki/Daylight_ saving_time_around_the_world#Europe

北美夏令时十一月的第一个星期日发生变化。
http://en.wikipedia.org/wiki/Daylight_ saving_time_around_the_world#North_America

根据评论进行编辑提供更准确的信息。

The World DST time vs the North American DST time are sometimes inconsistent.

In Europe the DST changes on the last Sunday of October.
http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#Europe

In North America DST changes on the first Sunday of November.
http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#North_America

Edit due to comments providing more accurate info.

风苍溪 2024-10-07 07:19:55

我认为,它在 00:05 运行,但在“新”(冬季)时间是 23:05。

I think, it ran at 00:05, but in "new"(winter) time it was 23:05.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文