@Immutable public enum PersianMonth extends java.lang.Enum<PersianMonth>
PersianMonth is an enum representing the 12 months of the year
Farvardin, Ordibehesht, Khordad, Tir, Mordad, Shahrivar, Mehr, Aban, Azar, Dey,
Bahman and Esfand.
In addition to the textual enum name, each month-of-year has an int value.
The int value follows normal usage and the ISO-8601 standard,
from 1 (January) to 12 (December). It is recommended that applications use the enum
rather than the int value to ensure code clarity.
Do not use ordinal() to obtain the numeric representation of Month.
Use getValue() instead.
This is an immutable enum and can be used in concurrent programs.
| Enum Constant and Description |
|---|
ABAN
The singleton instance for the month of Aban with 30 days.
|
AZAR
The singleton instance for the month of Azar with 30 days.
|
BAHMAN
The singleton instance for the month of Bahman with 30 days.
|
DEY
The singleton instance for the month of Dey with 30 days.
|
ESFAND
The singleton instance for the month of Farvardin with 29 days in non-leap year
and 30 days in leap year.
|
FARVARDIN
The singleton instance for the month of Farvardin with 31 days.
|
KHORDAD
The singleton instance for the month of Khordad with 31 days.
|
MEHR
The singleton instance for the month of Mehr with 30 days.
|
MORDAD
The singleton instance for the month of Mordad with 31 days.
|
ORDIBEHESHT
The singleton instance for the month of Ordibehesht with 31 days.
|
SHAHRIVAR
The singleton instance for the month of Shahrivar with 31 days.
|
TIR
The singleton instance for the month of Tir with 31 days.
|
| Modifier and Type | Method and Description |
|---|---|
int |
daysToFirstOfMonth()
Returns elapsed days from first of the year to first of this month.
|
java.lang.String |
getPersianName()
Returns name of month in persian alphabe.
|
int |
getValue() |
int |
length(boolean leapYear)
Returns length of month.
|
int |
maxLength()
Returns length of month in a leap year.
|
int |
minLength()
Returns length of month in a non-leap year.
|
PersianMonth |
minus(long months)
Returns a month-of-year that is
months before current month. |
PersianMonth |
plus(long months)
Returns a month-of-year that is
months after current month. |
static PersianMonth |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static PersianMonth[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PersianMonth FARVARDIN
1.public static final PersianMonth ORDIBEHESHT
2.public static final PersianMonth KHORDAD
3.public static final PersianMonth TIR
4.public static final PersianMonth MORDAD
5.public static final PersianMonth SHAHRIVAR
6.public static final PersianMonth MEHR
7.public static final PersianMonth ABAN
8.public static final PersianMonth AZAR
9.public static final PersianMonth DEY
10.public static final PersianMonth BAHMAN
11.public static final PersianMonth ESFAND
12.public static PersianMonth[] values()
for (PersianMonth c : PersianMonth.values()) System.out.println(c);
public static PersianMonth valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String getPersianName()
public int getValue()
public int length(boolean leapYear)
31 is returned.
For the second six months of year except Esfand, 30 is returned.
Finlally For Esfand, if leapYear is true, it returns 30, otherwise
it returns 29.leapYear - true, if length of months in leap year is requiredpublic int maxLength()
31 is returned. For the second six months of year 30 is returned.public int minLength()
31 is returned. For the second six months of year except Esfand, 30
is returned. For Esfand 29 is returned.public PersianMonth plus(long months)
months after current month. The calculation
rolls around end of year from Esfand to Farvardin.
This enum is immutable and unaffected by calling this method.
months - the months to add, positive or negativepublic PersianMonth minus(long months)
months before current month. The calculation
rolls around the start of year from Farvardin to Esfand.
This enum is immutable and unaffected by calling this method.
months - the months to subtract, positive or negativepublic int daysToFirstOfMonth()
Copyright © 2021. All rights reserved.