congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Year.plus
Code IndexAdd Tabnine to your IDE (free)

How to use
plus
method
in
java.time.Year

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

origin: com.github.seratch/java-time-backport

/**
 * {@inheritDoc}
 * @throws DateTimeException {@inheritDoc}
 * @throws ArithmeticException {@inheritDoc}
 */
@Override
public Year minus(long amountToSubtract, TemporalUnit unit) {
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, unit));
}
origin: chhsiao90/nitmproxy

public static Certificate newCert(String parentCertFile, String keyFile, String host) {
  try {
    Date before = Date.from(Instant.now());
    Date after = Date.from(Year.now().plus(3, ChronoUnit.YEARS).atDay(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
    X509CertificateHolder parent = readPemFromFile(parentCertFile);
    PEMKeyPair pemKeyPair = readPemFromFile(keyFile);
    KeyPair keyPair = new JcaPEMKeyConverter()
        .setProvider(PROVIDER)
        .getKeyPair(pemKeyPair);
    X509v3CertificateBuilder x509 = new JcaX509v3CertificateBuilder(
        parent.getSubject(),
        new BigInteger(64, new SecureRandom()),
        before,
        after,
        new X500Name("CN=" + host),
        keyPair.getPublic());
    ContentSigner signer = new JcaContentSignerBuilder("SHA256WithRSAEncryption")
        .build(keyPair.getPrivate());
    JcaX509CertificateConverter x509CertificateConverter = new JcaX509CertificateConverter()
        .setProvider(PROVIDER);
    return new Certificate(
        keyPair,
        x509CertificateConverter.getCertificate(x509.build(signer)),
        x509CertificateConverter.getCertificate(parent));
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
}
java.timeYearplus

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,
  • plusYears,
  • getLong,
  • minusYears,
  • <init>,
  • get,
  • length,
  • range

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • getSystemService (Context)
  • findViewById (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • 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