本文整理了Java中java.time.zone.ZoneRules.of()
方法的一些代码示例,展示了ZoneRules.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRules.of()
方法的具体详情如下:
包路径:java.time.zone.ZoneRules
类名称:ZoneRules
方法名:of
[英]Obtains an instance of ZoneRules that always uses the same offset.
The returned rules always have the same offset.
[中]获取始终使用相同偏移量的ZoneRules实例。
返回的规则始终具有相同的偏移量。
代码示例来源:origin: wildfly/wildfly
assertTrue(immutability.test(YearMonth.now()));
assertTrue(immutability.test(ZoneOffset.UTC));
assertTrue(immutability.test(ZoneRules.of(ZoneOffset.UTC).nextTransition(Instant.now())));
assertTrue(immutability.test(ZoneOffsetTransitionRule.of(Month.JANUARY, 1, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, true, TimeDefinition.STANDARD, ZoneOffset.UTC, ZoneOffset.ofHours(1), ZoneOffset.ofHours(2))));
assertTrue(immutability.test(ZoneRules.of(ZoneOffset.UTC)));
assertTrue(immutability.test(ZonedDateTime.now()));
assertTrue(immutability.test(new JCIPImmutableObject()));
代码示例来源:origin: com.github.seratch/java-time-backport
/**
* Gets the associated time-zone rules.
* <p>
* The rules will always return this offset when queried.
* The implementation class is immutable, thread-safe and serializable.
*
* @return the rules, not null
*/
@Override
public ZoneRules getRules() {
return ZoneRules.of(this);
}
内容来源于网络,如有侵权,请联系作者删除!