public enum Month extends Enum<Month> implements ChronoCondition<GregorianDate>
Enumeration of months in ISO-8601-calendar.
| Enum Constant and Description |
|---|
APRIL
April with the numerical ISO-value
4. |
AUGUST
August with the numerical ISO-value
8. |
DECEMBER
December with the numerical ISO-value
12. |
FEBRUARY
February with the numerical ISO-value
2. |
JANUARY
January with the numerical ISO-value
1. |
JULY
July with the numerical ISO-value
7. |
JUNE
June with the numerical ISO-value
6. |
MARCH
March with the numerical ISO-value
3. |
MAY
May with the numerical ISO-value
5. |
NOVEMBER
November with the numerical ISO-value
11. |
OCTOBER
October with the numerical ISO-value
10. |
SEPTEMBER
September with the numerical ISO-value
9. |
| Modifier and Type | Method and Description |
|---|---|
static Month |
atEndOfQuarterYear(Quarter quarterOfYear)
Gets the last month of given quarter of year.
|
static Month |
atStartOfQuarterYear(Quarter quarterOfYear)
Gets the first month of given quarter of year.
|
static Month |
from(Month threetenMonth)
Conversion from the
java.time-equivalent. |
String |
getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT). |
String |
getDisplayName(Locale locale,
TextWidth width,
OutputContext context)
Gets the description text dependent on the locale and style
parameters.
|
int |
getLength(int year)
Calculates the maximum length of this month in days dependent on
given year (taking into account leap years).
|
Quarter |
getQuarterOfYear()
Calculates the corresponding quarter of year.
|
int |
getValue()
Gets the corresponding numerical value.
|
Month |
next()
Rolls to the next month.
|
static Month |
parse(CharSequence text,
Locale locale,
TextWidth width,
OutputContext context)
Tries to interprete given text as month.
|
Month |
previous()
Rolls to the previous month.
|
Month |
roll(int months)
Rolls this month by given amount of months.
|
boolean |
test(GregorianDate context)
Decides if given context matches this condition.
|
Month |
toTemporalAccessor()
Conversion to the
java.time-equivalent. |
static Month |
valueOf(int month)
Gets the enum-constant which corresponds to the given numerical
value.
|
static Month |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Month[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Month JANUARY
1.public static final Month FEBRUARY
2.public static final Month MARCH
3.public static final Month APRIL
4.public static final Month MAY
5.public static final Month JUNE
6.public static final Month JULY
7.public static final Month AUGUST
8.public static final Month SEPTEMBER
9.public static final Month OCTOBER
10.public static final Month NOVEMBER
11.public static final Month DECEMBER
12.public static Month[] values()
for (Month c : Month.values()) System.out.println(c);
public static Month valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Month valueOf(int month)
Gets the enum-constant which corresponds to the given numerical value.
month - gregorian month in the range [1-12]IllegalArgumentException - if given argument is out of rangepublic int getValue()
Gets the corresponding numerical value.
public Quarter getQuarterOfYear()
Calculates the corresponding quarter of year.
public static Month atStartOfQuarterYear(Quarter quarterOfYear)
Gets the first month of given quarter of year.
quarterOfYear - quarter of year (Q1-Q4)public static Month atEndOfQuarterYear(Quarter quarterOfYear)
Gets the last month of given quarter of year.
quarterOfYear - quarter of year (Q1-Q4)public int getLength(int year)
Calculates the maximum length of this month in days dependent on given year (taking into account leap years).
year - proleptic iso yearpublic Month next()
Rolls to the next month.
The result is January if applied on December.
public Month previous()
Rolls to the previous month.
The result is December if applied on January.
public Month roll(int months)
Rolls this month by given amount of months.
months - count of months (maybe negative)public String getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT).
locale - language settingnull)getDisplayName(Locale, TextWidth, OutputContext)public String getDisplayName(Locale locale, TextWidth width, OutputContext context)
Gets the description text dependent on the locale and style parameters.
The second argument controls the width of description while the third argument is only relevant for languages which make a difference between stand-alone forms and embedded text forms (does not matter in English).
locale - language settingwidth - text widthcontext - output contextnull)public static Month parse(CharSequence text, Locale locale, TextWidth width, OutputContext context) throws ParseException
Tries to interprete given text as month.
text - the text to be parsedlocale - language settingwidth - expected text widthcontext - expected output contextParseException - if parsing failsgetDisplayName(Locale, TextWidth, OutputContext)public boolean test(GregorianDate context)
ChronoConditionDecides if given context matches this condition.
Due to better readability it is recommended to use following equivalent approach instead of this method::
import static net.time4j.Weekday.SATURDAY; import static net.time4j.Month.JANUARY; PlainDate date = PlainDate.of(2014, JANUARY, 25); System.out.println(SATURDAY.test(date)); // direct use System.out.println(date.matches(SATURDAY)); // recommended callback
test in interface Predicate<GregorianDate>test in interface ChronoCondition<GregorianDate>context - context as base of testing this conditiontrue if given time context matches this condition
else falsepublic Month toTemporalAccessor()
Conversion to the java.time-equivalent.
from(java.time.Month)public static Month from(Month threetenMonth)
Conversion from the java.time-equivalent.
threetenMonth - month value to be convertedtoTemporalAccessor()Copyright © 2014–2017. All rights reserved.