gpt4 book ai didi

java.time.zone.ZoneRules.getDaylightSavings()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 15:48:40 26 4
gpt4 key购买 nike

本文整理了Java中java.time.zone.ZoneRules.getDaylightSavings()方法的一些代码示例,展示了ZoneRules.getDaylightSavings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRules.getDaylightSavings()方法的具体详情如下:
包路径:java.time.zone.ZoneRules
类名称:ZoneRules
方法名:getDaylightSavings

ZoneRules.getDaylightSavings介绍

[英]Gets the amount of daylight savings in use for the specified instant in this zone.

This provides access to historic information on how the amount of daylight savings has changed over time. This is the difference between the standard offset and the actual offset. Typically the amount is zero during winter and one hour during summer. Time-zones are second-based, so the nanosecond part of the duration will be zero.
[中]获取此区域中指定时刻的夏时制使用量。
这提供了有关夏令时数量随时间变化的历史信息。这是标准偏移和实际偏移之间的差异。通常情况下,冬季为零,夏季为一小时。时区是以秒为基础的,因此持续时间的纳秒部分将为零。

代码示例

代码示例来源:origin: alblue/com.packtpub.e4

public String getText(Object element) {
  if (element instanceof ZoneId) {
    return String.valueOf(!((ZoneId) element).getRules().getDaylightSavings(Instant.now()).isZero());
  } else {
    return "";
  }
}

代码示例来源:origin: net.time4j/time4j-olson

int previousOffset = zot.getOffsetBefore().getTotalSeconds();
int totalOffset = zot.getOffsetAfter().getTotalSeconds();
int dst = Math.toIntExact(zoneRules.getDaylightSavings(instant).getSeconds());
transitions.add(new ZonalTransition(posixTime, previousOffset, totalOffset, dst));

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com