- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
夏令时在美国/东部时区 11 月 1 日凌晨 2 点结束。结果,凌晨 2 点变成了凌晨 1 点。
我无法理解下面给出的代码中的以下内容:
为什么第 4 行显示时间 10:00,为什么不是 09:00(加上 24 小时)?
LocalDateTime ld = LocalDateTime.of(2015, Month.OCTOBER, 31, 10, 0);
ZonedDateTime date = ZonedDateTime.of(ld, ZoneId.of("US/Eastern"));
System.out.println(date); //line 1 - 2015-10-31T10:00-04:00[US/Eastern]
date = date.plus(Duration.ofDays(1));
System.out.println(date); //line 2 - 2015-11-01T09:00-05:00[US/Eastern]
date = ZonedDateTime.of(ld, ZoneId.of("US/Eastern"));
System.out.println(date); //line 3 - 2015-10-31T10:00-04:00[US/Eastern]
date = date.plus(Period.ofDays(1));
System.out.println(date); //line 4 - 2015-11-01T10:00-05:00[US/Eastern]
有人可以帮我吗?
最佳答案
Duration:尽管 ofDays
方法 Duration
没有天的概念。 Duration.ofDays(1)
会立即转换为 24 小时,因此这就是您要添加的内容。由于您在 DST 结束前一天将 24 小时加到 10:00,因此您将在第二天获得 09:00,
Period:与Duration
相反,Period
有天、周、月和年。因此,您要添加 1 个日历日,在第二天 (10:00) 到达相同的挂钟时间,即使这意味着 25 小时后(而不是 24 小时)。
关于java - 在夏令时前后将 Duration.ofDays(1) 和 Period.ofDays(1) 添加到 ZonedDateTime 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53287725/
举个例子,让我们使用以下 cron 表达式:“0 0 14 1 * ?” -> 在每月第一天的 14:00 触发。 我使用 Quartz CronScheduleBuilder 来构建表达式,但这无关
由于某种原因,夏令时开始时,我的一个网站在午夜 12:00 自动发布,从晚上 11:00 开始发布。有什么方法可以设置 MySQL 服务器变量以正确处理夏令时更改吗? 最佳答案 请提供... SHOW
如何检查夏令时是否生效? 最佳答案 您可以使用time.localtime并查看返回值中的 tm_isdst 标志。 >>> import time >>> time.localtime() (201
我有一个奇怪的问题: 我从 mysql 数据库中获取一些数据,我将这些数据用 strotime 转换为时间戳。然后我将这些时间戳与 for 循环进行比较: for ($i=$start;$imodif
如何检查夏令时是否有效? 最佳答案 您可以使用 time.localtime并查看返回值中的 tm_isdst 标志。 >>> import time >>> time.localtime() (20
我使用以下代码在文件中生成日期: echo "DTSTART;TZID=" . date_default_timezone_get() . ":" . strftime('%Y%m%d', strto
在下面,为什么 to_char() 中不包含夏令时?我怎样才能获得夏令时的时间? SELECT systimestamp AT TIME ZONE 'Australia/Adelaide' from
以下是连续两天之间的小时数计算: (AbsoluteTime[{2011, 3, 14}] - AbsoluteTime[{2011, 3, 13}]) / 3600 因此,您可能不会对 Mathem
function DateTimeToFileTime(FileTime: TDateTime): TFileTime; var LocalFileTime, Ft: TFileTime; S
我制作了一个小代码片段。告诉你几岁,精确到秒。 但是我发现了一些奇怪的事情。我知道时间和时区是工作的噩梦,但这是在我自己的国家和时区内,所以我有点困惑。 如果我输入日期。 27-12-2013(dd-
在 Jenkins 的夜间构建中,我们的一项测试在凌晨 2:00:12 失败。经过一段时间的调试和更改计算机的系统时间后,我感到非常困惑。然后我写了下面的测试(模拟问题),它失败了,但我不明白为什么。
linux如何处理夏令时(DST) 切换是否立即发生,例如 3 点钟立即切换到 2 点钟?或者变化缓慢我问你这个是因为我的服务器上有很大的日期基础,如果这个切换在数据库中的条目上立即发生一小时,将会
我正在使用 NSDate 格式化程序从 Facebook Graph API 请求(格林威治标准时间)获取日期并将其转换为用户的本地时区。我可以很好地读取日期并设置它的新时区,但是当我打印出新日期时,
我的 API 使用 ISO 8601 向客户端表示时间。我们有一个功能,我们希望显示它来自哪个时区。通过纯粹存储时区偏移,我们正在失去对细节的跟踪。 即,犹他州和亚利桑那州遵守 MST -06:00半
PHP代码 $t = strtotime( '2012-09-21T03:00:00+00:00 America/Chicago' ); $t2 = date('c',$t); echo $t2;
PHP代码 $t = strtotime( '2012-09-21T03:00:00+00:00 America/Chicago' ); $t2 = date('c',$t); echo $t2;
我有这个问题。我有这个格式的日期 var datestring = "2017-10-30T15:03:10.933044Z"; 如果我这样写代码 var d = new Date(datestrin
每当日光切换发生时,我都会触发事件。 我知道何时会发生 Spring /秋季切换 TimeZone.CurrentTimeZone.GetDaylightChanges(year) 这会返回 2 个日
我正在开发一个关心夏令时变化的关键应用程序。 我试图通过比较跨越夏令时变化的日期来手动模拟运行时可能发生的情况,因此我进行了以下测试。我当前所在的位置是意大利,因此今年从 CEST(中欧夏令时)更改为
我有这个应用程序,它将当前日期与来自 xml 文件的已解析日期进行比较: Date timeDiff = new Date(date.getTime() - new Date().getTime())
我是一名优秀的程序员,十分优秀!