public class HebrewDateFormatter extends Object
JewishDate.
The class formats Jewish dates in Hebrew or Latin chars, and has various settings. Sample full date output includes
(using various options):
JewishDate,
JewishCalendar| Constructor and Description |
|---|
HebrewDateFormatter() |
| Modifier and Type | Method and Description |
|---|---|
String |
format(JewishDate jewishDate)
Formats the Jewish date.
|
String |
formatDafYomiBavli(Daf daf) |
String |
formatDayOfWeek(JewishDate jewishDate)
Formats the day of week.
|
String |
formatHebrewNumber(int number)
Returns a Hebrew formatted string of a number.
|
String |
formatMonth(JewishDate jewishDate)
Returns a string of the current Hebrew month such as "Tishrei".
|
String |
formatOmer(JewishCalendar jewishCalendar)
Returns a String of the Omer day in the form ל״ג בעומר if
Hebrew Format is set, or "Omer X" or "Lag BaOmer" if not.
|
String |
formatParsha(JewishCalendar jewishCalendar)
If the formatter is set to format in Hebrew, returns a string of the current parsha(ios) in Hebrew for example
בראשית or ניצבים
וילך or an empty string if there are none.
|
String |
formatRoshChodesh(JewishCalendar jewishCalendar) |
String |
formatYomTov(JewishCalendar jewishCalendar)
Formats the Yom Tov (holiday) in Hebrew or transliterated Latin characters.
|
String |
getFormattedKviah(int jewishYear)
|
String |
getHebrewOmerPrefix()
Returns the Hebrew Omer prefix.
|
String[] |
getTransliteratedHolidayList()
Returns the list of holidays transliterated into Latin chars.
|
String[] |
getTransliteratedMonthList()
Returns the list of months transliterated into Latin chars.
|
String[] |
getTransliteratedParshiosList()
Retruns the list of transliterated parshiyos used by this formatter.
|
String |
getTransliteratedShabbosDayOfWeek()
Returns the day of Shabbos transliterated into Latin chars.
|
boolean |
isHebrewFormat()
Returns if the formatter is set to use Hebrew formatting in the various formatting methods.
|
boolean |
isLongWeekFormat()
returns if the
formatDayOfWeek(JewishDate) will use the long format such as
ראשון or short such as א when formatting the day of week in
Hebrew. |
boolean |
isUseGershGershayim()
Returns whether the class is set to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and
numbers.
|
boolean |
isUseLongHebrewYears()
Returns whether the class is set to use the thousands digit when formatting.
|
void |
setHebrewFormat(boolean hebrewFormat)
Sets the formatter to format in Hebrew in the various formatting methods.
|
void |
setHebrewOmerPrefix(String hebrewOmerPrefix)
Method to set the Hebrew Omer prefix.
|
void |
setLongWeekFormat(boolean longWeekFormat)
Setting to control if the
formatDayOfWeek(JewishDate) will use the long format such as
ראשון or short such as א when formatting the day of week in
Hebrew. |
void |
setTransliteratedHolidayList(String[] transliteratedHolidays)
Sets the list of holidays transliterated into Latin chars.
|
void |
setTransliteratedMonthList(String[] transliteratedMonths)
Setter method to allow overriding of the default list of months transliterated into into Latin chars.
|
void |
setTransliteratedParshiosList(String[] transliteratedParshios)
Setter method to allow overriding of the default list of parshiyos transliterated into into Latin chars.
|
void |
setTransliteratedShabbosDayOfWeek(String transliteratedShabbos)
Setter to override the default transliterated name of "Shabbos" to alternate spelling such as "Shabbat" used by
the
formatDayOfWeek(JewishDate) |
void |
setUseGershGershayim(boolean useGershGershayim)
Sets whether to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and numbers.
|
void |
setUseLongHebrewYears(boolean useLongHebrewYears)
When formatting a Hebrew Year, traditionally the thousands digit is omitted and output for a year such as 5729
(1969 Gregorian) would be calculated for 729 and format as תשכ״ט.
|
public HebrewDateFormatter()
public boolean isLongWeekFormat()
formatDayOfWeek(JewishDate) will use the long format such as
ראשון or short such as א when formatting the day of week in
Hebrew.setLongWeekFormat(boolean),
formatDayOfWeek(JewishDate)public void setLongWeekFormat(boolean longWeekFormat)
formatDayOfWeek(JewishDate) will use the long format such as
ראשון or short such as א when formatting the day of week in
Hebrew.longWeekFormat - the longWeekFormat to setpublic String getTransliteratedShabbosDayOfWeek()
setTransliteratedShabbosDayOfWeek(String)setTransliteratedShabbosDayOfWeek(String),
formatDayOfWeek(JewishDate)public void setTransliteratedShabbosDayOfWeek(String transliteratedShabbos)
formatDayOfWeek(JewishDate)transliteratedShabbos - the transliteratedShabbos to setgetTransliteratedShabbosDayOfWeek(),
formatDayOfWeek(JewishDate)public String[] getTransliteratedHolidayList()
formatYomTov(JewishCalendar) when formatting the Yom Tov String. The default list of months uses
Ashkenazi pronunciation in typical American English spelling.setTransliteratedMonthList(String[]),
formatYomTov(JewishCalendar),
isHebrewFormat()public void setTransliteratedHolidayList(String[] transliteratedHolidays)
formatYomTov(JewishCalendar) when formatting the Yom Tov String.transliteratedHolidays - the transliteratedHolidays to set. Ensure that the sequence exactly matches the list returned by the
defaulytpublic String formatYomTov(JewishCalendar jewishCalendar)
jewishCalendar - isHebrewFormat()public String formatRoshChodesh(JewishCalendar jewishCalendar)
public boolean isHebrewFormat()
setHebrewFormat(boolean),
format(JewishDate),
formatDayOfWeek(JewishDate),
formatMonth(JewishDate),
formatOmer(JewishCalendar),
formatParsha(JewishCalendar),
formatYomTov(JewishCalendar)public void setHebrewFormat(boolean hebrewFormat)
hebrewFormat - the hebrewFormat to setisHebrewFormat(),
format(JewishDate),
formatDayOfWeek(JewishDate),
formatMonth(JewishDate),
formatOmer(JewishCalendar),
formatParsha(JewishCalendar),
formatYomTov(JewishCalendar)public String getHebrewOmerPrefix()
setHebrewOmerPrefix(String).setHebrewOmerPrefix(String),
formatOmer(JewishCalendar)public void setHebrewOmerPrefix(String hebrewOmerPrefix)
hebrewOmerPrefix - the hebrewOmerPrefix to set. You can use the Unicode \u05DC to set it to ל.getHebrewOmerPrefix(),
formatOmer(JewishCalendar)public String[] getTransliteratedMonthList()
setTransliteratedMonthList(String[])public void setTransliteratedMonthList(String[] transliteratedMonths)
transliteratedMonths - an array of 14 month names such as { "Nissan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Tishrei",
"Heshvan", "Kislev", "Tevet", "Shevat", "Adar", "Adar II", "Adar I" }getTransliteratedMonthList()public String[] getTransliteratedParshiosList()
public void setTransliteratedParshiosList(String[] transliteratedParshios)
transliteratedParshios - the transliterated Parshios to setgetTransliteratedParshiosList()public String formatDayOfWeek(JewishDate jewishDate)
Hebrew formatting is set, it will display in the format
ראשון etc. If Hebrew formatting is not in use it will return it in the format
of Sunday etc. There are various formatting options that will affect the output.jewishDate - isHebrewFormat(),
isLongWeekFormat()public String formatParsha(JewishCalendar jewishCalendar)
jewishCalendar - public boolean isUseGershGershayim()
public void setUseGershGershayim(boolean useGershGershayim)
useGershGershayim - set to false to omit the Geresh ׳ and Gershayim ״ in formattingpublic boolean isUseLongHebrewYears()
public void setUseLongHebrewYears(boolean useLongHebrewYears)
useLongHebrewYears - Set this to true to use the long formattingpublic String format(JewishDate jewishDate)
jewishDate - the JewishDate to be formattedpublic String formatMonth(JewishDate jewishDate)
jewishDate - the JewishDate to formatisHebrewFormat(),
setHebrewFormat(boolean),
getTransliteratedMonthList(),
setTransliteratedMonthList(String[])public String formatOmer(JewishCalendar jewishCalendar)
setHebrewOmerPrefix(String) method to use a ל and output
ל״ג לעומר.isHebrewFormat(),
getHebrewOmerPrefix(),
setHebrewOmerPrefix(String)public String getFormattedKviah(int jewishYear)
Shelaimim , Kesidran or Chaserim) and the 3rd letter
represents the day of week of Pesach. For example 5729 (1969) would return בשה (Rosh Hashana on
Monday, Shelaimim, and Pesach on Thursday), while 5771 (2011) would return השג (Rosh Hashana on
Thursday, Shelaimim, and Pesach on Tuesday).jewishYear - the Jewish yearpublic String formatDafYomiBavli(Daf daf)
public String formatHebrewNumber(int number)
number - the number to be formatted. It will trow an IllegalArgumentException if the number is < 0 or > 9999.Copyright © 2004 - 2011 Eliyahu Hershfeld. All Rights Reserved. Released under the LGPL 2.1 license