- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.time.Year.plusYears()
方法的一些代码示例,展示了Year.plusYears()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Year.plusYears()
方法的具体详情如下:
包路径:java.time.Year
类名称:Year
方法名:plusYears
[英]Returns a copy of this year with the specified number of years added.
This instance is immutable and unaffected by this method call.
[中]返回添加了指定年份数的本年副本。
此实例是不可变的,不受此方法调用的影响。
代码示例来源:origin: com.github.seratch/java-time-backport
/**
* Returns a copy of this year with the specified number of years subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param yearsToSubtract the years to subtract, may be negative
* @return a {@code Year} based on this year with the period subtracted, not null
* @throws DateTimeException if the result exceeds the supported year range
*/
public Year minusYears(long yearsToSubtract) {
return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
}
代码示例来源:origin: org.codehaus.groovy/groovy-datetime
/**
* Returns a {@link java.time.Year} that is {@code years} years after this year.
*
* @param self a Year
* @param years the number of years to add
* @return a Year
* @since 2.5.0
*/
public static Year plus(final Year self, long years) {
return self.plusYears(years);
}
代码示例来源:origin: com.sqlapp/sqlapp-core
/**
* 年の加算を実行します
*
* @param date
* 日付型
* @param years
* 加算する年
* @return 年を加算した結果のカレンダー
*/
public static Year addYears(final Year date, final int years) {
if (date == null) {
return null;
}
return date.plusYears(years);
}
代码示例来源:origin: com.github.seratch/java-time-backport
/**
* {@inheritDoc}
* @throws DateTimeException {@inheritDoc}
* @throws ArithmeticException {@inheritDoc}
*/
@Override
public Year plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
switch ((ChronoUnit) unit) {
case YEARS: return plusYears(amountToAdd);
case DECADES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 10));
case CENTURIES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 100));
case MILLENNIA: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 1000));
case ERAS: return with(ERA, Jdk8Methods.safeAdd(getLong(ERA), amountToAdd));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
代码示例来源:origin: org.xbib/catalog-entities
private String convertFromMarcDate(String date) {
if (date.indexOf('|') >= 0) {
// invalid date / no date
return null;
}
try {
// yy maps to 2000-2099 which is wrong, cataloging era is somewhere around 1970-2070
LocalDate localDatetime = LocalDate.parse(date, formatter);
// adjust year. If in the future, subtract 100 to go back to 20th century cataloging.
// one year tolerance, maybe "future cataloging"
if (localDatetime.getYear() > Year.now().plusYears(1).getValue()) {
localDatetime = localDatetime.minusYears(100);
}
return localDatetime.toString();
} catch (Exception e) {
logger.log(Level.WARNING, "unable to convert date: " + date, e);
return date;
}
}
}
我已经进行了一些搜索,但要么没有找到合适的示例,要么可能我还不能完全掌握一些概念。 我正在尝试编写一个函数,让用户输入一个日期(从表单中)并在接下来的 50 年中每年返回该日期为星期五的日期。我确信我
本文整理了Java中java.time.Year.plusYears()方法的一些代码示例,展示了Year.plusYears()的具体用法。这些代码示例主要来源于Github/Stackoverfl
本文整理了Java中java.time.YearMonth.plusYears()方法的一些代码示例,展示了YearMonth.plusYears()的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中java.time.ZonedDateTime.plusYears()方法的一些代码示例,展示了ZonedDateTime.plusYears()的具体用法。这些代码示例主要来源于
本文整理了Java中org.threeten.bp.Year.plusYears()方法的一些代码示例,展示了Year.plusYears()的具体用法。这些代码示例主要来源于Github/Stack
我是一名优秀的程序员,十分优秀!