public class JewishDate extends Object implements Comparable<JewishDate>, Cloneable
JewishCalendar,
HebrewDateFormatter,
Date,
Calendar| Modifier and Type | Field and Description |
|---|---|
static int |
ADAR
Value of the month field indicating Adar (or Adar I in a
leap year), the twelfth
numeric month of the year in the Jewish calendar. |
static int |
ADAR_II
Value of the month field indicating Adar II, the leap (intercalary or embolismic) thirteenth (Undecimber) numeric
month of the year added in Jewish
leap year). |
static int |
AV
Value of the month field indicating Av, the fifth numeric month of the year in the Jewish calendar.
|
static int |
CHASERIM
|
static int |
CHESHVAN
Value of the month field indicating Cheshvan/marcheshvan, the eighth numeric month of the year in the Jewish
calendar.
|
static int |
ELUL
Value of the month field indicating Elul, the sixth numeric month of the year in the Jewish calendar.
|
static int |
IYAR
Value of the month field indicating Iyar, the second numeric month of the year in the Jewish calendar.
|
static int |
KESIDRAN
|
static int |
KISLEV
Value of the month field indicating Kislev, the ninth numeric month of the year in the Jewish calendar.
|
static int |
NISSAN
Value of the month field indicating Nissan, the first numeric month of the year in the Jewish calendar.
|
static int |
SHELAIMIM
|
static int |
SHEVAT
Value of the month field indicating Shevat, the eleventh numeric month of the year in the Jewish calendar.
|
static int |
SIVAN
Value of the month field indicating Sivan, the third numeric month of the year in the Jewish calendar.
|
static int |
TAMMUZ
Value of the month field indicating Tammuz, the fourth numeric month of the year in the Jewish calendar.
|
static int |
TEVES
Value of the month field indicating Teves, the tenth numeric month of the year in the Jewish calendar.
|
static int |
TISHREI
Value of the month field indicating Tishrei, the seventh numeric month of the year in the Jewish calendar.
|
| Constructor and Description |
|---|
JewishDate()
Default constructor will set a default date to the current system date.
|
JewishDate(Calendar calendar)
A constructor that initializes the date to the
Calendar paremeter. |
JewishDate(Date date)
A constructor that initializes the date to the
Date paremeter. |
JewishDate(int jewishYear,
int jewishMonth,
int jewishDayOfMonth)
Creates a Jewish date based on a Jewish year, month and day of month.
|
JewishDate(long molad)
Constructor that creates a JewishDate based on a molad passed in.
|
| Modifier and Type | Method and Description |
|---|---|
void |
back()
Rolls the date back by 1 day.
|
Object |
clone()
A method that creates a deep copy of the object.
|
int |
compareTo(JewishDate jewishDate)
Compares two dates as per the compareTo() method in the Comparable interface.
|
boolean |
equals(Object object) |
void |
forward()
Rolls the date forward by 1 day.
|
protected int |
getAbsDate()
Returns the absolute date (days since January 1, 0001 on the Gregorian calendar).
|
long |
getChalakimSinceMoladTohu()
Returns the number of chalakim (parts - 1080 to the hour) from the original hypothetical Molad Tohu to the Jewish
year and month that this Object is set to.
|
int |
getCheshvanKislevKviah()
Returns the Cheshvan and Kislev kviah (whether a Jewish year is short, regular or long).
|
int |
getDayOfWeek()
Returns the day of the week as a number between 1-7.
|
int |
getDaysInJewishMonth()
Returns the number of days of the Jewish month that the calendar is currently set to.
|
int |
getDaysInJewishYear()
Returns the number of days for the current year that the calendar is set to.
|
static int |
getDaysInJewishYear(int year)
Returns the number of days for a given Jewish year.
|
int |
getGregorianDayOfMonth()
Returns the Gregorian day of the month.
|
int |
getGregorianMonth()
Returns the Gregorian month (between 0-11).
|
int |
getGregorianYear()
Returns the Gregotian year.
|
static int |
getJewishCalendarElapsedDays(int year)
Returns the number of days elapsed from the Sunday prior to the start of the Jewish calendar to the mean
conjunction of Tishri of the Jewish year.
|
int |
getJewishDayOfMonth()
Returns the Jewish day of month.
|
int |
getJewishMonth()
Returns the Jewish month 1-12 (or 13 years in a leap year).
|
int |
getJewishYear()
Returns the Jewish year.
|
(package private) int |
getLastDayOfGregorianMonth(int month)
Returns the last day in a gregorian month
|
JewishDate |
getMolad()
Returns the molad for a given year and month.
|
int |
getMoladChalakim()
Returns the molad chalakim/parts.
|
int |
getMoladHours()
Returns the molad hours.
|
int |
getMoladMinutes()
Returns the molad minutes.
|
Date |
getTime()
Returns this object's date as a java.util.Date object.
|
int |
hashCode() |
boolean |
isCheshvanLong()
Returns if Cheshvan is long (30 days VS 29 days) for the current year that the calendar is set to.
|
boolean |
isJewishLeapYear()
Returns if the year the calendar is set to is a Jewish leap year.
|
boolean |
isKislevShort()
Returns if the Kislev is short for the year that this class is set to.
|
void |
resetDate()
Resets this date to the current system date.
|
void |
setDate(Calendar calendar)
Sets the date based on a
Calendar object. |
void |
setDate(Date date)
Sets the date based on a
Date object. |
void |
setGregorianDate(int year,
int month,
int dayOfMonth)
Sets the Gregorian Date, and updates the Jewish date accordingly.
|
void |
setGregorianDayOfMonth(int dayOfMonth)
sets the Gregorian Day of month.
|
void |
setGregorianMonth(int month)
Sets the Gregorian month.
|
void |
setGregorianYear(int year)
sets the Gregorian year.
|
void |
setJewishDate(int year,
int month,
int dayOfMonth)
Sets the Jewish Date and updates the Gregorian date accordingly.
|
void |
setJewishDate(int year,
int month,
int dayOfMonth,
int hours,
int minutes,
int chalakim)
Sets the Jewish Date and updates the Gregorian date accordingly.
|
void |
setJewishDayOfMonth(int dayOfMonth)
sets the Jewish day of month.
|
void |
setJewishMonth(int month)
sets the Jewish month.
|
void |
setJewishYear(int year)
sets the Jewish year.
|
void |
setMoladChalakim(int moladChalakim)
Sets the molad chalakim/parts.
|
void |
setMoladHours(int moladHours)
Sets the molad hours.
|
void |
setMoladMinutes(int moladMinutes)
Sets the molad minutes.
|
String |
toString()
Returns a string containing the Jewish date in the form, "day Month, year" e.g. "21 Shevat, 5729".
|
public static final int NISSAN
TISHREI, it would actually be the 7th (or 8th in a leap
year) month of the year.public static final int IYAR
TISHREI, it would actually be the 8th (or 9th in a leap
year) month of the year.public static final int SIVAN
TISHREI, it would actually be the 9th (or 10th in a leap
year) month of the year.public static final int TAMMUZ
TISHREI, it would actually be the 10th (or 11th in a leap
year) month of the year.public static final int AV
TISHREI, it would actually be the 11th (or 12th in a leap year)
month of the year.public static final int ELUL
TISHREI, it would actually be the 12th (or 13th in a leap
year) month of the year.public static final int TISHREI
public static final int CHESHVAN
TISHREI, it would actually be the 2nd month of the year.public static final int KISLEV
TISHREI, it would actually be the 3rd month of the year.public static final int TEVES
TISHREI, it would actually be the 4th month of the year.public static final int SHEVAT
TISHREI, it would actually be the 5th month of the year.public static final int ADAR
leap year), the twelfth
numeric month of the year in the Jewish calendar. With the year starting at TISHREI, it would actually
be the 6th month of the year.public static final int ADAR_II
leap year). The leap years are years 3, 6, 8, 11,
14, 17 and 19 of a 19 year cycle. With the year starting at TISHREI, it would actually be the 7th month
of the year.public static final int CHASERIM
public static final int KESIDRAN
public static final int SHELAIMIM
public JewishDate(long molad)
molad - public JewishDate(int jewishYear, int jewishMonth, int jewishDayOfMonth)
jewishYear - the Jewish yearjewishMonth - the Jewish month. The method expects a 1 for Nissan ... 12 for Adar and 13 for Adar II. Use the
constants NISSAN ... ADAR (or ADAR_II for a leap year Adar II) to avoid any
confusion.jewishDayOfMonth - the Jewish day of month. If 30 is passed in for a month with only 29 days (for example IYAR,
or KISLEV in a year that isKislevShort()), the 29th (last valid date of the month)
will be setIllegalArgumentException - if the day of month is < 1 or > 30, or a year of < 0 is passed in.public JewishDate()
public JewishDate(Date date)
Date paremeter.date - the Date to set the calendar toIllegalArgumentException - if the date would fall prior to the January 1, 1 ADpublic JewishDate(Calendar calendar)
Calendar paremeter.calendar - the Calendar to set the calendar toIllegalArgumentException - if the Calendar.ERA is GregorianCalendar.BCpublic int getMoladHours()
getMolad(),
setJewishDate(int, int, int, int, int, int) or setMoladHours(int) will have this field
populated. A regular JewishDate object will have this field set to 0.setMoladHours(int),
getMolad(),
setJewishDate(int, int, int, int, int, int)public void setMoladHours(int moladHours)
moladHours - the molad hours to setgetMoladHours(),
getMolad(),
setJewishDate(int, int, int, int, int, int)public int getMoladMinutes()
getMolad(),
setJewishDate(int, int, int, int, int, int) or or setMoladMinutes(int) will have these fields
populated. A regular JewishDate object will have this field set to 0.setMoladMinutes(int),
getMolad(),
setJewishDate(int, int, int, int, int, int)public void setMoladMinutes(int moladMinutes)
chalakim/parts , so 793 (TaShTZaG) parts would have the minutes set to
44 and chalakim to 1.moladMinutes - the molad minutes to setgetMoladMinutes(),
setMoladChalakim(int),
getMolad(),
setJewishDate(int, int, int, int, int, int)public void setMoladChalakim(int moladChalakim)
minutes and chalakim, so 793 (TaShTZaG) parts would have the minutes set to 44 and
chalakim to 1.moladChalakim - the molad chalakim/parts to setgetMoladChalakim(),
setMoladMinutes(int),
getMolad(),
setJewishDate(int, int, int, int, int, int)public int getMoladChalakim()
getMolad(),
setJewishDate(int, int, int, int, int, int) or or setMoladChalakim(int) will have these fields
populated. A regular JewishDate object will have this field set to 0.setMoladChalakim(int),
getMolad(),
setJewishDate(int, int, int, int, int, int)int getLastDayOfGregorianMonth(int month)
month - the Gregorian monthprotected int getAbsDate()
public boolean isJewishLeapYear()
isJewishLeapYear(int)public static int getJewishCalendarElapsedDays(int year)
year - the Jewish yearpublic long getChalakimSinceMoladTohu()
public static int getDaysInJewishYear(int year)
year - the Jewish yearisCheshvanLong(),
isKislevShort()public int getDaysInJewishYear()
isCheshvanLong(),
isKislevShort(),
isJewishLeapYear()public boolean isCheshvanLong()
isCheshvanLong()public boolean isKislevShort()
public int getCheshvanKislevKviah()
SHELAIMIM if both cheshvan and kislev are 30 days, KESIDRAN if Cheshvan is 29 days and Kislev
is 30 days and CHASERIM if both are 29 days.SHELAIMIM if both cheshvan and kislev are 30 days, KESIDRAN if Cheshvan is 29 days and
Kislev is 30 days and CHASERIM if both are 29 days.isCheshvanLong(),
isKislevShort()public int getDaysInJewishMonth()
public JewishDate getMolad()
Object set to the date of the molad
with the hours, minutes and chalakim set. In the current implementation, it sets the molad time based on a midnight date rollover. This
means that Rosh Chodesh Adar II, 5771 with a molad of 7 chalakim past midnight on Shabbos 29 Adar I / March 5,
2011 12:00 AM and 7 chalakim, will have the following values: hours: 0, minutes: 0, Chalakim: 7.public void setDate(Calendar calendar)
Calendar object. Modifies the Jewish date as well.calendar - the Calendar to set the calendar toIllegalArgumentException - if the Calendar.ERA is GregorianCalendar.BCpublic void setDate(Date date)
Date object. Modifies the Jewish date as well.date - the Date to set the calendar toIllegalArgumentException - if the date would fall prior to the year 1 ADpublic void setGregorianDate(int year, int month, int dayOfMonth)
year - the Gregorian yearmonth - the Gregorian month. Like the Java Calendar, this class expects 0 for JanuarydayOfMonth - the Gregorian day of month. If this is > the number of days in the month/year, the last valid date of
the month will be setIllegalArgumentException - if a year of < 1, a month < 0 or > 11 or a day of month < 1 is passed inpublic void setJewishDate(int year, int month, int dayOfMonth)
year - the Jewish year. The year can't be negativemonth - the Jewish month starting with Nisan. A value of 1 is expected for Nissan ... 12 for Adar and 13 for
Adar II. Use the constants NISSAN ... ADAR (or ADAR_II for a leap year Adar
II) to avoid any confusion.dayOfMonth - the Jewish day of month. valid values are 1-30. If the day of month is set to 30 for a month that only
has 29 days, the day will be set as 29.IllegalArgumentException - if a A Jewish date earlier than 18 Teves, 3761 (1/1/1 Gregorian), a month < 1 or > 12 (or 13 on a
leap year) or the day of month is < 1 or > 30 is passed inpublic void setJewishDate(int year, int month, int dayOfMonth, int hours, int minutes, int chalakim)
year - the Jewish year. The year can't be negativemonth - the Jewish month starting with Nisan. A value of 1 is expected for Nissan ... 12 for Adar and 13 for
Adar II. Use the constants NISSAN ... ADAR (or ADAR_II for a leap year Adar
II) to avoid any confusion.dayOfMonth - the Jewish day of month. valid values are 1-30. If the day of month is set to 30 for a month that only
has 29 days, the day will be set as 29.hours - the hour of the day. Used for Molad calculationsminutes - the minutes. Used for Molad calculationschalakim - the chalakim/parts. Used for Molad calculations. The chalakim should not exceed 17. Minutes should be
used for larger numbers.IllegalArgumentException - if a A Jewish date earlier than 18 Teves, 3761 (1/1/1 Gregorian), a month < 1 or > 12 (or 13 on a
leap year), the day of month is < 1 or > 30, an hour < 0 or > 23, a minute < 0 > 59 or chalakim < 0 >
17. For larger a larger number of chalakim such as 793 (TaShTzaG) break the chalakim into minutes (18
chalakim per minutes, so it would be 44 minutes and 1 chelek in the case of 793 (TaShTzaG).public Date getTime()
Datepublic void resetDate()
public String toString()
toString in class ObjectHebrewDateFormatter.format(JewishDate)public void forward()
Calendar class Calendar.add(int, int) or
Calendar.roll(int, int) methods in the following manner.
Calendar cal = jewishDate.getTime(); // get a java.util.Calendar representation of the JewishDate
cal.add(Calendar.MONTH, 3); // add 3 Gregorian months
jewishDate.setDate(cal); // set the updated calendar back to this class
back(),
Calendar.add(int, int),
Calendar.roll(int, int)public void back()
Calendar class Calendar.add(int, int) or
Calendar.roll(int, int) methods in the following manner.
Calendar cal = jewishDate.getTime(); // get a java.util.Calendar representation of the JewishDate
cal.add(Calendar.MONTH, -3); // subtract 3 Gregorian months
jewishDate.setDate(cal); // set the updated calendar back to this class
back(),
Calendar.add(int, int),
Calendar.roll(int, int)public boolean equals(Object object)
equals in class ObjectObject.equals(Object)public int compareTo(JewishDate jewishDate)
compareTo in interface Comparable<JewishDate>public int getGregorianMonth()
public int getGregorianDayOfMonth()
public int getGregorianYear()
public int getJewishMonth()
public int getJewishDayOfMonth()
public int getJewishYear()
public int getDayOfWeek()
public void setGregorianMonth(int month)
month - the Gregorian monthIllegalArgumentException - if a month < 0 or > 11 is passed inpublic void setGregorianYear(int year)
year - the Gregorian year.IllegalArgumentException - if a year of < 1 is passed inpublic void setGregorianDayOfMonth(int dayOfMonth)
dayOfMonth - the Gregorian Day of month.IllegalArgumentException - if the day of month of < 1 is passed inpublic void setJewishMonth(int month)
month - the Jewish month from 1 to 12 (or 13 years in a leap year). The month count starts with 1 for Nisan
and goes to 13 for Adar IIIllegalArgumentException - if a month < 1 or > 12 (or 13 on a leap year) is passed inpublic void setJewishYear(int year)
year - the Jewish yearIllegalArgumentException - if a year of < 3761 is passed in. The same will happen if the year is 3761 and the month and day
previously set are < 18 Teves (preior to Jan 1, 1 AD)public void setJewishDayOfMonth(int dayOfMonth)
dayOfMonth - the Jewish day of monthIllegalArgumentException - if the day of month is < 1 or > 30 is passed inpublic Object clone()
clone in class ObjectObject.clone()public int hashCode()
hashCode in class ObjectObject.hashCode()Copyright © 2004 - 2013 Eliyahu Hershfeld. All Rights Reserved. Released under the LGPL 2.1 license