congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Year.plusYears
Code IndexAdd Tabnine to your IDE (free)

How to use
plusYears
method
in
java.time.Year

Best Java code snippets using java.time.Year.plusYears (Showing top 5 results out of 315)

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;
    }
  }
}
java.timeYearplusYears

Javadoc

Returns a copy of this year with the specified number of years added.

This instance is immutable and unaffected by this method call.

Popular methods of Year

  • of
    Obtains an instance of Year. This method accepts a year value from the proleptic ISO calendar system
  • getValue
    Gets the year value. The year returned by this method is proleptic as per get(YEAR).
  • parse
    Obtains an instance of Year from a text string using a specific formatter. The text is parsed using
  • now
    Obtains the current year from the system clock in the specified time-zone. This will query the Clock
  • toString
    Outputs this year as a String.
  • atDay
    Combines this year with a day-of-year to create a LocalDate. This returns a LocalDate formed from th
  • from
    Obtains an instance of Year from a temporal object. A TemporalAccessor represents some form of date
  • isLeap
    Checks if the year is a leap year, according to the ISO proleptic calendar system rules. This method
  • atMonthDay
    Combines this year with a month-day to create a LocalDate. This returns a LocalDate formed from this
  • format
    Outputs this year as a String using the formatter. This year will be passed to the formatter DateTim
  • atMonth
    Combines this year with a month to create a YearMonth. This returns a YearMonth formed from this yea
  • compareTo
    Compares this year to another year. The comparison is based on the value of the year. It is "consist
  • atMonth,
  • compareTo,
  • getLong,
  • minusYears,
  • plus,
  • <init>,
  • get,
  • length,
  • range

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now