java.time.Period.minusDays()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(172)

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

Period.minusDays介绍

[英]Returns a copy of this period with the specified days subtracted.

This subtracts the amount from the days unit in a copy of this period. The years and months units are unaffected. For example, "1 year, 6 months and 3 days" minus 2 days returns "1 year, 6 months and 1 day".

This instance is immutable and unaffected by this method call.
[中]返回减去指定天数后的该时段的副本。
这将从该期间副本的天数单位中减去金额。年和月单位不受影响。例如,“1年、6个月和3天”减去2天返回“1年、6个月和1天”。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy-datetime

/**
 * Returns a {@link java.time.Period} that is {@code days} days shorter than this period.
 * No normalization is performed.
 *
 * @param self a Period
 * @param days the number of days to decrease this Period by
 * @return a Period
 * @since 2.5.0
 */
public static Period minus(final Period self, long days) {
  return self.minusDays(days);
}

代码示例来源:origin: xjdr/xio

.commonName("Test Client")
    .notBefore(Date.from(now.minus(aWeek)))
    .notAfter(Date.from(now.minus(aWeek.minusDays(1))))
    .build();
group = new NioEventLoopGroup(2);

相关文章