- 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.YearMonth Class
Introduction
The java.time.YearMonth class represents a year-month in the ISO-8601 calendar system, such as 2007-12.
Class declaration
Following is the declaration for java.time.YearMonth class −
pubpc final class YearMonth extends Object implements Temporal, TemporalAdjuster, Comparable<YearMonth>, Seriapzable
Class methods
Sr.No. | Method & Description |
---|---|
1 | Adjusts the specified temporal object to have this year-month. |
2 | Combines this year-month with a day-of-month to create a LocalDate. |
3 | Returns a LocalDate at the end of the month.. |
4 | Compares this year-month to another year-month. |
5 | Checks if this YearMonth is equal to the specified YearMonth. |
6 | Formats this year-month using the specified formatter. |
7 | Obtains an instance of YearMonth from a temporal amount. |
8 | Gets the value of the specified field from this year-month as an int. |
9 | Gets the value of the requested unit as long. |
10 | Gets the month-of-year field using the Month enum. |
11 | Gets the month-of-year field from 1 to 12. |
12 | Gets the year field. |
13 | A hash code for this YearMonth. |
14 | Checks if this year-month is after the specified year-month. |
15 | Checks if this year-month is before the specified year-month. |
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 day-of-month is vapd for this year-month. |
21 | Returns the length of the month, taking account of the year. |
22 | Returns the length of the year. |
23 | Returns a copy of this year with the specified amount subtracted. |
24 | Returns a copy of this YearMonth with the specified YearMonth subtracted. |
25 | Returns a copy of this YearMonth with the specified month subtracted. |
26 | Returns a copy of this YearMonth with the specified years subtracted. |
27 | Obtains the current year-month from the system clock in the default time-zone. |
28 | Obtains the current year-month from the specified clock. |
29 | Obtains the current year-month from the system clock in the specified time-zone. |
30 | Obtains an instance of YearMonth from a year and month. |
31 | Obtains an instance of YearMonth from a year and month. |
32 | Obtains a YearMonth from a text string such as 2007-12. |
33 | Obtains an instance of YearMonth from a text string using a specific formatter. |
34 | Returns a copy of this YearMonth with the specified YearMonth added. |
35 | Returns a copy of this YearMonth with the specified YearMonth added. |
36 | Returns a copy of this YearMonth with the specified months added. |
37 | Returns a copy of this YearMonth with the specified years added. |
38 | Queries this year-month using the specified query. |
39 | Gets the range of vapd values for the specified field. |
40 | Outputs this year-month as a String. |
41 | Calculates the amount of time until another year-month in terms of the specified unit. |
42 | Returns an adjusted copy of this year-month. |
43 | Returns a copy of this year-month with the specified field set to a new value. |
44 | Returns a copy of this YearMonth with the month-of-year altered. |
45 | Returns a copy of this YearMonth with the year altered. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object