- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.time.ZonedDateTime.isAfter()
方法的一些代码示例,展示了ZonedDateTime.isAfter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonedDateTime.isAfter()
方法的具体详情如下:
包路径:java.time.ZonedDateTime
类名称:ZonedDateTime
方法名:isAfter
暂无
代码示例来源:origin: spring-cloud/spring-cloud-gateway
@Override
public Predicate<ServerWebExchange> apply(Config config) {
ZonedDateTime datetime = config.getDatetime();
return exchange -> {
final ZonedDateTime now = ZonedDateTime.now();
return now.isAfter(datetime);
};
}
代码示例来源:origin: spring-cloud/spring-cloud-gateway
@Override
public Predicate<ServerWebExchange> apply(Config config) {
ZonedDateTime datetime1 = config.datetime1;
ZonedDateTime datetime2 = config.datetime2;
Assert.isTrue(datetime1.isBefore(datetime2),
config.datetime1 +
" must be before " + config.datetime2);
return exchange -> {
final ZonedDateTime now = ZonedDateTime.now();
return now.isAfter(datetime1) && now.isBefore(datetime2);
};
}
代码示例来源:origin: blynkkk/blynk-server
@Override
public ZonedDateTime getNextTriggerTime(ZonedDateTime zonedNow, ZoneId zoneId) {
ZonedDateTime zonedStartAt = buildZonedStartAt(zonedNow, zoneId);
return zonedStartAt.isAfter(zonedNow) ? zonedStartAt : zonedStartAt.plusDays(1);
}
}
代码示例来源:origin: blynkkk/blynk-server
@Override
public ZonedDateTime getNextTriggerTime(ZonedDateTime zonedNow, ZoneId zoneId) {
ZonedDateTime zonedStartAt = buildZonedStartAt(zonedNow, zoneId);
DayOfWeek dayOfWeek = DayOfWeek.of(dayOfTheWeek);
zonedStartAt = zonedStartAt.with(TemporalAdjusters.nextOrSame(dayOfWeek));
return zonedStartAt.isAfter(zonedNow)
? zonedStartAt
: zonedStartAt.with(TemporalAdjusters.next(dayOfWeek));
}
}
代码示例来源:origin: blynkkk/blynk-server
@Override
public ZonedDateTime getNextTriggerTime(ZonedDateTime zonedNow, ZoneId zoneId) {
ZonedDateTime zonedStartAt = buildZonedStartAt(zonedNow, zoneId);
switch (dayOfMonth) {
case LAST:
zonedStartAt = zonedStartAt.with(TemporalAdjusters.lastDayOfMonth());
return zonedStartAt.isAfter(zonedNow)
? zonedStartAt
: zonedStartAt.plusDays(1).with(TemporalAdjusters.lastDayOfMonth());
case FIRST:
default:
zonedStartAt = zonedStartAt.with(TemporalAdjusters.firstDayOfMonth());
return zonedStartAt.isAfter(zonedNow)
? zonedStartAt
: zonedStartAt.with(TemporalAdjusters.firstDayOfNextMonth());
}
}
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Verifies that the actual {@code ZonedDateTime} is <b>strictly</b> after the given one.
* <p>
* Comparison is done on {@code ZonedDateTime}'s instant (i.e. {@link ZonedDateTime#toEpochSecond()})
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T00:00:00Z")).isAfter(parse("1999-12-31T23:59:59Z"));</code></pre>
*
* @param other the given {@link ZonedDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code ZonedDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code ZonedDateTime} is {@code null}.
* @throws AssertionError if the actual {@code ZonedDateTime} is not strictly after the given one.
*/
public SELF isAfter(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (!actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeAfter(actual, other));
}
return myself;
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Verifies that the actual {@code ZonedDateTime} is before or equals to the given one.
* <p>
* Comparison is done on {@code ZonedDateTime}'s instant (i.e. {@link ZonedDateTime#toEpochSecond()})
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T23:59:59Z")).isBeforeOrEqualTo(parse("2000-01-01T23:59:59Z"))
* .isBeforeOrEqualTo(parse("2000-01-02T00:00:00Z"));</code></pre>
*
* @param other the given {@link ZonedDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code ZonedDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code ZonedDateTime} is {@code null}.
* @throws AssertionError if the actual {@code ZoneDateTime} is not before or equals to the given one.
*/
public SELF isBeforeOrEqualTo(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
}
return myself;
}
代码示例来源:origin: blynkkk/blynk-server
private ZonedDateTime adjustToStartDate(ZonedDateTime zonedStartAt, ZonedDateTime zonedNow, ZoneId zoneId) {
if (durationType == ReportDurationType.CUSTOM) {
ZonedDateTime zonedStartDate = getZonedFromTs(startTs, zoneId).with(LocalTime.MIN);
if (zonedStartDate.isAfter(zonedNow)) {
zonedStartAt = zonedStartAt
.withDayOfMonth(zonedStartDate.getDayOfMonth())
.withMonth(zonedStartDate.getMonthValue())
.withYear(zonedStartDate.getYear());
}
}
return zonedStartAt;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Verifies that the actual {@code ZonedDateTime} is <b>strictly</b> after the given one.
* <p>
* Comparison is done on {@code ZonedDateTime}'s instant (i.e. {@link ZonedDateTime#toEpochSecond()})
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T00:00:00Z")).isAfter(parse("1999-12-31T23:59:59Z"));</code></pre>
*
* @param other the given {@link ZonedDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code ZonedDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code ZonedDateTime} is {@code null}.
* @throws AssertionError if the actual {@code ZonedDateTime} is not strictly after the given one.
*/
public SELF isAfter(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (!actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeAfter(actual, other));
}
return myself;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Verifies that the actual {@code ZonedDateTime} is before or equals to the given one.
* <p>
* Comparison is done on {@code ZonedDateTime}'s instant (i.e. {@link ZonedDateTime#toEpochSecond()})
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T23:59:59Z")).isBeforeOrEqualTo(parse("2000-01-01T23:59:59Z"))
* .isBeforeOrEqualTo(parse("2000-01-02T00:00:00Z"));</code></pre>
*
* @param other the given {@link ZonedDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code ZonedDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code ZonedDateTime} is {@code null}.
* @throws AssertionError if the actual {@code ZoneDateTime} is not before or equals to the given one.
*/
public SELF isBeforeOrEqualTo(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
}
return myself;
}
代码示例来源:origin: benas/random-beans
@Override
protected void checkValues() {
if (min.isAfter(max)) {
throw new IllegalArgumentException("max must be after min");
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public boolean isAfter(JodaCompatibleZonedDateTime o) {
return dt.isAfter(o.getZonedDateTime());
}
代码示例来源:origin: eclipse/smarthome
@Override
public State calculate(Set<Item> items) {
if (items != null && items.size() > 0) {
ZonedDateTime max = null;
for (Item item : items) {
DateTimeType itemState = item.getStateAs(DateTimeType.class);
if (itemState != null) {
if (max == null || max.isAfter(itemState.getZonedDateTime())) {
max = itemState.getZonedDateTime();
}
}
}
if (max != null) {
return new DateTimeType(max);
}
}
return UnDefType.UNDEF;
}
代码示例来源:origin: apache/metron
if(inputDateWithCurrentYear.isAfter(currentDate.plusDays(4L))) {
ZonedDateTime inputDateWithPreviousYear =
ZonedDateTime.of(currentYear-1, inputMonth, inputDay, inputHour, inputMinute, inputSecond, 0, deviceTimeZone);
代码示例来源:origin: io.sphere.sdk.jvm/sphere-java-client-core
/**
* if the last token has no expire time it true
* @return
*/
private boolean lastTokenIsStillValid() {
if (currentTokensOption.isPresent()) {
final Tokens oldTokens = currentTokensOption.get();
return Optional.ofNullable(oldTokens.getExpiresZonedDateTime()).map(expireTime -> expireTime.isAfter(ZonedDateTime.now())).orElse(true);
} else {
return false;
}
}
代码示例来源:origin: OpenGamma/Strata
@Override
public DoubleArray apply(DoubleArray x) {
SabrParametersIborCapletFloorletVolatilities volsNew = updateParameters(volatilities, nExpiries, timeIndex, betaFixed, x);
return DoubleArray.of(nCaplets,
n -> capList.get(currentStart + n).getCapletFloorletPeriods().stream()
.filter(p -> p.getFixingDateTime().isAfter(prevExpiry))
.mapToDouble(p -> sabrPeriodPricer.presentValue(p, ratesProvider, volsNew).getAmount())
.sum() / priceList.get(currentStart + n));
}
};
代码示例来源:origin: org.apereo.cas/cas-server-core-util-api
/**
* Determines whether the given CRL is expired by comparing the nextUpdate field
* with a given date.
*
* @param crl CRL to examine.
* @param reference Reference date for comparison.
* @return True if reference date is after CRL next update, false otherwise.
*/
public static boolean isExpired(final X509CRL crl, final ZonedDateTime reference) {
return reference.isAfter(DateTimeUtils.zonedDateTimeOf(crl.getNextUpdate()));
}
代码示例来源:origin: org.apereo.cas/cas-server-core-events
@Override
public Collection<? extends CasEvent> getEventsOfTypeForPrincipal(final String type, final String principal, final ZonedDateTime dateTime) {
return getEventsOfTypeForPrincipal(type, principal)
.stream()
.filter(e -> e.getCreationZonedDateTime().isEqual(dateTime) || e.getCreationZonedDateTime().isAfter(dateTime))
.collect(Collectors.toSet());
}
代码示例来源:origin: org.apereo.cas/cas-server-core-events
@Override
public Collection<? extends CasEvent> load(final ZonedDateTime dateTime) {
return load().stream()
.filter(e -> e.getCreationZonedDateTime().isEqual(dateTime) || e.getCreationZonedDateTime().isAfter(dateTime))
.collect(Collectors.toSet());
}
代码示例来源:origin: OpenGamma/Strata
private double priceFixed(
ResolvedIborCapFloorLeg cap,
RatesProvider ratesProvider,
IborCapletFloorletVolatilities vols,
ZonedDateTime prevExpiry) {
VolatilityIborCapletFloorletPeriodPricer periodPricer = getLegPricer().getPeriodPricer();
return cap.getCapletFloorletPeriods().stream()
.filter(p -> !p.getFixingDateTime().isAfter(prevExpiry))
.mapToDouble(p -> periodPricer.presentValue(p, ratesProvider, vols).getAmount())
.sum();
}
我创建了两个 ZonedDateTime 对象,我认为它们应该相等: public static void main(String[] args) { ZoneId zid = ZoneId.
假设我有一个 ZonedDateTime: ZonedDateTime zonedDateTime = ZonedDateTime.of(LocalDateTime.now(), ZoneI
给定以下单元测试: @Test public void zonedDateTimeCorrectlyRestoresItself() { // construct a new instance
我正在尝试将 ZonedDateTime 与以下代码进行比较: val now = ZonedDateTime.now() val query = for { x Timestamp.from(
我最近迁移到 Java 8,希望能更轻松地处理本地和分区时间。 但是,在我看来,在解析简单日期时,我遇到了一个简单的问题。 public static ZonedDateTime convertirA
您好,我已经搜索过类似的问题,但没有成功。我正在调用一个 ws,它将一个 token 发回给我,当它是有效的示例时: { "token": ..., "notBefore":"Thu 21
我有一个 ZonedDateTime 对象,我想根据给定的区域设置对其进行格式化。 IE。在美国,我希望格式为“M-dd-yy”,但在英国则应为“dd-M-yy”。 在给定的语言环境下执行此操作的最佳
在比较 ZonedDateTimes 时,使用 和 == 并不总是与使用 .isBefore、.isAfter 和 isEqual 相同,如下面的 Kotlin 示例所示: import java.
我有以下功能 public String getDateAndTimeInUserFormat(String value, DateTimeFormat inputFormat) { retu
我的时间以毫秒为单位,我需要将其转换为 ZonedDateTime 对象。 我有以下代码 long m = System.currentTimeMillis(); LocalDateTime d =
我尝试将字符串转换为 ZonedDateTime。这是我的代码: String startTime = "Wed Mar 21 2018 08:00:00 GMT 0330 (IRST)"; Stri
在比较 ZonedDateTimes 时,使用 和 == 并不总是与使用 .isBefore、.isAfter 和 isEqual 相同,如下面的 Kotlin 示例所示: import java.
我正在尝试获取存储为 UTC 的日期时间并将其转换为给定时区的日期时间。据我所知,ZonedDateTime 是正确的(“美国/芝加哥”比 UTC 晚 5 小时),但 DateTimeFormatte
我需要将字符串 2020-04-15T23:00:00+0000 转换为 ZonedDateTime。我尝试了以下方法,但没有成功: DateTimeFormatter formatter = Dat
如何将已设置的 ZonedDateTime 时间更改为“java.time.LocalTime.MIN”或“java.time.LocalTime.MAX”? ZonedDateTime date =
我正在尝试将字符串转换为 ZonedDateTime。 我尝试过以下操作: SimpleDateFormat zonedDateTimeFormat = new SimpleDateFormat("y
我目前正在研究日期在英国夏令时间之内和之外时的 ZonedDateTime 行为。 英国夏令时间从 3 月 25 日开始,增加一小时 (+1)。 我创建了几个 ZonedDateTime 实例(UTC
ZonedDateTime zdt3 = ZonedDateTime.parse("1999-09-09 09:09:09.999", DateTimeFormatter.of
我有一个返回年、月、日和小时的 DTO。因此将值从 DTO 传递到 ZonedDateTime.of 方法。此处,时间显示为太平洋标准时间上午 10 点。因此,尝试将其转换为 UTC。 当传递月份为
String ip="2011-05-01T06:47:35.422-05:00"; ZonedDateTime mzt = ZonedDateTime.parse(ip).toInstant().a
我是一名优秀的程序员,十分优秀!