gpt4 book ai didi

org.threeten.bp.zone.ZoneRules.isDaylightSavings()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 12:09:31 28 4
gpt4 key购买 nike

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

ZoneRules.isDaylightSavings介绍

[英]Checks if the specified instant is in daylight savings.

This checks if the standard and actual offsets are the same at the specified instant.
[中]检查指定的时间是否为夏令时。
这将检查在指定的瞬间标准偏移和实际偏移是否相同。

代码示例

代码示例来源:origin: stackoverflow.com

ZoneRules rules = zdt.getZone().getRules();
Boolean dstInEffect = rules.isDaylightSavings( zdt.toInstant() );

代码示例来源:origin: stackoverflow.com

ZonedDateTime zdt = ...;
ZoneRules rules = zdt.getZone().getRules();
boolean isDst = rules.isDaylightSavings(zdt.toInstant());

代码示例来源:origin: stackoverflow.com

ZonedDateTime now = ZonedDateTime.now( ZoneId.of( "America/Montreal" ) );
…
ZoneId z = now.getZone();
ZoneRules zoneRules = z.getRules();
Boolean isDst = zoneRules.isDaylightSavings( now.toInstant() );

代码示例来源:origin: ThreeTen/threetenbp

@Override
public boolean print(DateTimePrintContext context, StringBuilder buf) {
  ZoneId zone = context.getValue(TemporalQueries.zoneId());
  if (zone == null) {
    return false;
  }
  if (zone.normalized() instanceof ZoneOffset) {
    buf.append(zone.getId());
    return true;
  }
  TemporalAccessor temporal = context.getTemporal();
  boolean daylight = false;
  if (temporal.isSupported(INSTANT_SECONDS)) {
    Instant instant = Instant.ofEpochSecond(temporal.getLong(INSTANT_SECONDS));
    daylight = zone.getRules().isDaylightSavings(instant);
  }
  TimeZone tz = TimeZone.getTimeZone(zone.getId());
  int tzstyle = (textStyle.asNormal() == TextStyle.FULL ? TimeZone.LONG : TimeZone.SHORT);
  String text = tz.getDisplayName(daylight, tzstyle, context.getLocale());
  buf.append(text);
  return true;
}

代码示例来源:origin: org.threeten/threetenbp

@Override
public boolean print(DateTimePrintContext context, StringBuilder buf) {
  ZoneId zone = context.getValue(TemporalQueries.zoneId());
  if (zone == null) {
    return false;
  }
  if (zone.normalized() instanceof ZoneOffset) {
    buf.append(zone.getId());
    return true;
  }
  TemporalAccessor temporal = context.getTemporal();
  boolean daylight = false;
  if (temporal.isSupported(INSTANT_SECONDS)) {
    Instant instant = Instant.ofEpochSecond(temporal.getLong(INSTANT_SECONDS));
    daylight = zone.getRules().isDaylightSavings(instant);
  }
  TimeZone tz = TimeZone.getTimeZone(zone.getId());
  int tzstyle = (textStyle.asNormal() == TextStyle.FULL ? TimeZone.LONG : TimeZone.SHORT);
  String text = tz.getDisplayName(daylight, tzstyle, context.getLocale());
  buf.append(text);
  return true;
}

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