- java.time - Discussion
- java.time - Month
- java.time - ZoneOffset
- java.time - ZoneId
- java.time - ZonedDateTime
- java.time - YearMonth
- java.time - Year
- java.time - Period
- java.time - OffsetTime
- java.time - OffsetDateTime
- java.time - MonthDay
- java.time - LocalTime
- java.time - LocalDateTime
- java.time - LocalDate
- java.time - Instant
- java.time - Duration
- java.time - Clock
- java.time - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
java.time.Year Class
Introduction
The java.time.Year class represents a year in the ISO-8601 calendar system, such as 2007.
Class declaration
Following is the declaration for java.time.Year class −
pubpc final class Year extends Object implements Temporal, TemporalAdjuster, Comparable<Year>, Seriapzable
Field
Following are the fields for Java.time.Period class −
static int MAX_VALUE − The maximum supported year, +999,999,999 .
static int MIN_VALUE − The minimum supported year, -999,999,999 .
Class methods
Sr.No. | Method & Description |
---|---|
1 | Adjusts the specified temporal object to have this year. |
2 | Combines this year with a day-of-year to create a LocalDate. |
3 | YearMonth atMonth(int month) Combines this year with a month to create a YearMonth. |
4 | YearMonth atMonth(Month month) Combines this year with a month to create a YearMonth. |
5 | LocalDate atMonthDay(MonthDay monthDay) Combines this year with a month-day to create a LocalDate. |
6 | Compares this year to another year. |
7 | Checks if this Year is equal to the specified Year. |
8 | Formats this year using the specified formatter. |
9 | Obtains an instance of Year from a temporal amount. |
10 | Gets the value of the specified field from this year as an int. |
11 | Gets the value of the requested unit as long. |
12 | Gets the year value. |
13 | A hash code for this Year. |
14 | Checks if this year is after the specified year. |
15 | Checks if this year is before the specified year. |
16 | Checks if the year is a leap year, according to the ISO proleptic calendar system rules. |
17 | Checks if the year is a leap year, according to the ISO proleptic calendar system rules. |
18 | Checks if the specified field is supported. |
19 | Checks if the specified unit is supported. |
20 | Checks if the month-day is vapd for this year. |
21 | Gets the length of this year in days. |
22 | Returns a copy of this year with the specified amount subtracted. |
23 | Returns a copy of this Year with the specified Year subtracted. |
24 | Returns a copy of this Year with the specified years subtracted. |
25 | Obtains the current year from the system clock in the default time-zone. |
26 | Obtains the current year from the specified clock. |
27 | Obtains the current year from the system clock in the specified time-zone. |
28 | Obtains an instance of Year. |
29 | Obtains a Year from a text string such as 2007. |
30 | Obtains an instance of Year from a text string using a specific formatter. |
31 | Returns a copy of this Year with the specified Year added. |
32 | Returns a copy of this Year with the specified Year added. |
33 | Year plusMonths(long monthsToAdd) Returns a copy of this Year with the specified months added. |
34 | Returns a copy of this Year with the specified years added. |
35 | Queries this year using the specified query. |
36 | Gets the range of vapd values for the specified field. |
37 | Outputs this year as a String. |
38 | Calculates the amount of time until another year in terms of the specified unit. |
39 | Returns an adjusted copy of this year. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object