public class HebrewCalendar
extends Calendar
| java.lang.Object | ||
| android.icu.util.Calendar | ||
| android.icu.util.HebrewCalendar | ||
HebrewCalendar是实现传统希伯来日历的Calendar的子类。 这是以色列的公民日历和全世界犹太教信仰的礼仪日历。
希伯来语的日历是阴历,因此有一些有趣的属性可以与格里高利区分开来。 月份从每个新月的(算术近似值)那天开始。 由于太阳年(大约365.24天)不是农历月的偶数倍(约29.53天),因此每19年增加7个“闰月”。 为了使事情更有趣,一年的开始可能会延迟三天,以防止某些假期落在安息日,并防止某些违法的年份。 最后,某些月份的长度可能会因一年中的天数而异。
闰月被称为“Adar 1”,并在闰年中插入Sheavat和Adar的月份之间。 由于闰月不会在年底结束,涉及月份数的计算尤其复杂。 此类的用户应确保使用roll和add方法,而不是通过直接操作字段来尝试执行日期算术。
注意:在传统的希伯来语日历中,日子从日落开始。 但是,为了使本课程中的时间字段与其他日历中的时间字段保持同步,并使用本地时钟时间,我们将日期和月份视为从午夜开始,大约相应日落后6小时。
如果您对希伯来日历背后规则的更多信息感兴趣,请参阅以下参考资料之一:
这个类不应该被分类。
希伯来文日历通常应该使用 getInstance(ULocale)实例化,传入 ULocale并标记为 "@calendar=hebrew" 。
也可以看看:
常量(Constants) |
|
|---|---|
int |
ADAR 阿达尔是希伯来年的第七个月。 |
int |
ADAR_1 对于希伯来文第六年的阿达尔一世(仅限于闰年)而言是不变的。 |
int |
AV Av是希伯来语年的第12个月。 |
int |
ELUL Elul是希伯来语年的第13个月。 |
int |
HESHVAN Heshvan是希伯来文第二个月的常数。 |
int |
IYAR 不断为希伯来年的第九个月的伊亚尔。 |
int |
KISLEV 对希斯莱夫来说是不变的,这是希伯来年的第三个月。 |
int |
NISAN 对于希伯来年的第八个月的尼散来说是不变的。 |
int |
SHEVAT Shevat是希伯来年的第五个月的常数。 |
int |
SIVAN Sivan是希伯来语年的第10个月。 |
int |
TAMUZ 塔姆慕兹,希伯来年的第11个月的恒定。 |
int |
TEVET Tevet是希伯来年的第四个月。 |
int |
TISHRI Tishri是希伯来文年的第一个月。 |
Inherited constants |
|---|
android.icu.util.Calendar
|
Inherited fields |
|---|
android.icu.util.Calendar
|
Public constructors |
|
|---|---|
HebrewCalendar() 构造一个默认 |
|
HebrewCalendar(TimeZone zone) 根据给定时区中的当前时间构建一个 |
|
HebrewCalendar(Locale aLocale) 根据给定语言环境的默认时区中的当前时间构造一个 |
|
HebrewCalendar(ULocale locale) 根据给定语言环境的默认时区中的当前时间构造一个 |
|
HebrewCalendar(TimeZone zone, Locale aLocale) 根据给定语言环境给定时区中的当前时间构造一个 |
|
HebrewCalendar(TimeZone zone, ULocale locale) 根据给定语言环境给定时区的当前时间构造一个 |
|
HebrewCalendar(int year, int month, int date) 使用默认时区中设置的给定日期构建 |
|
HebrewCalendar(Date date) 使用默认时区中设置的给定日期构建 |
|
HebrewCalendar(int year, int month, int date, int hour, int minute, int second) 使用默认的 |
|
公共方法(Public methods) |
|
|---|---|
void |
add(int field, int amount) 使用此日历规则将已签名的金额添加到指定的字段。 |
String |
getType() [icu]返回此Calendar对象的日历类型名称字符串。 |
void |
roll(int field, int amount) 在给定字段上滚动(向上/向下)指定的时间量。 |
Protected methods |
|
|---|---|
void |
handleComputeFields(int julianDay) 子类可以重写此方法来计算特定于每个日历系统的几个字段。 |
int |
handleComputeMonthStart(int eyear, int month, boolean useMonth) 返回给定月/年开始的JD。 |
int |
handleGetExtendedYear() 返回当前字段定义的扩展年份。 |
int |
handleGetLimit(int field, int limitType) 用于定义不同类型限制的子类API。 |
int |
handleGetMonthLength(int extendedYear, int month) 返回给定年份中给定月份的长度 |
int |
handleGetYearLength(int eyear) 返回给定希伯来语年的天数 |
继承方法(Inherited methods) |
|
|---|---|
android.icu.util.Calendar
|
|
java.lang.Object
|
|
java.lang.Comparable
|
|
int ADAR_1
对于希伯来文第六年的阿达尔一世(仅限于闰年)而言是不变的。 在非闰年中,日历从Shevat(第5个月)跳到Adar(第7个月)。
常量值:5(0x00000005)
HebrewCalendar ()
构造一个默认 HebrewCalendar使用默认时区的当前时间的默认 FORMAT语言环境。
也可以看看:
HebrewCalendar (TimeZone zone)
基于给定时区中的当前时间构建一个 HebrewCalendar ,并使用默认的 FORMAT区域设置。
| 参数(Parameters) | |
|---|---|
zone |
TimeZone: The time zone for the new calendar. |
也可以看看:
HebrewCalendar (Locale aLocale)
根据给定语言环境的默认时区中的当前时间构造一个 HebrewCalendar 。
| 参数(Parameters) | |
|---|---|
aLocale |
Locale: The locale for the new calendar. |
HebrewCalendar (ULocale locale)
根据给定语言环境的默认时区中的当前时间构造一个 HebrewCalendar 。
| 参数(Parameters) | |
|---|---|
locale |
ULocale: The locale for the new calendar. |
HebrewCalendar (TimeZone zone, Locale aLocale)
基于给定语言环境给定时区中的当前时间构造一个 HebrewCalendar 。
| 参数(Parameters) | |
|---|---|
zone |
TimeZone: The time zone for the new calendar. |
aLocale |
Locale: The locale for the new calendar. |
HebrewCalendar (TimeZone zone, ULocale locale)
基于给定语言环境给定时区内的当前时间构造一个 HebrewCalendar 。
| 参数(Parameters) | |
|---|---|
zone |
TimeZone: The time zone for the new calendar. |
locale |
ULocale: The locale for the new calendar. |
HebrewCalendar (int year,
int month,
int date)
使用默认时区中设置的给定日期构造 HebrewCalendar ,默认时区为 FORMAT区域设置。
| 参数(Parameters) | |
|---|---|
year |
int: The value used to set the calendar's YEAR time field. |
month |
int: The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri. |
date |
int: The value used to set the calendar's DATE time field. |
也可以看看:
HebrewCalendar (Date date)
使用默认时区中设置的给定日期构建 HebrewCalendar ,默认区域设置为 FORMAT 。
| 参数(Parameters) | |
|---|---|
date |
Date: The date to which the new calendar is set. |
也可以看看:
HebrewCalendar (int year,
int month,
int date,
int hour,
int minute,
int second)
构造一个 HebrewCalendar同为缺省默认时区设置定日期和时间 FORMAT语言环境。
| 参数(Parameters) | |
|---|---|
year |
int: The value used to set the calendar's YEAR time field. |
month |
int: The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri. |
date |
int: The value used to set the calendar's DATE time field. |
hour |
int: The value used to set the calendar's HOUR_OF_DAY time field. |
minute |
int: The value used to set the calendar's MINUTE time field. |
second |
int: The value used to set the calendar's SECOND time field. |
也可以看看:
void add (int field,
int amount)
使用此日历规则将已签名的金额添加到指定的字段。 例如,要在当前日期添加三天,您可以致电add(Calendar.DATE, 3) 。
添加到某些字段时,其他字段的值可能会发生冲突并需要更改。 例如,将1加到当MONTH的日期“30平均5758”领域, DAY_OF_MONTH字段必须被调整,使得结果是“29 5758以禄”,而不是无效的“30以禄5758”。
这种方法能够添加到除所有领域 ERA , DST_OFFSET ,并 ZONE_OFFSET 。
注意:您应该始终使用roll并添加而不是试图直接在HebrewCalendar的字段上执行算术运算。 由于MONTH字段在非闰年行为不连续,因此简单算术可能会导致无效结果。
| 参数(Parameters) | |
|---|---|
field |
int: the time field. |
amount |
int: the amount to add to the field. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
if the field is invalid or refers to a field that cannot be handled by this method. |
String getType ()
[icu]返回此Calendar对象的日历类型名称字符串。 返回的字符串是传统的ICU日历属性值,例如“gregorian”或“japanese”。
请参阅http://www.unicode.org/reports/tr35/#Key_Type_Definitions中有关语言环境ID的日历属性的type =“old type name”
| 返回(Returns) | |
|---|---|
String |
legacy calendar type name string |
void roll (int field,
int amount)
在给定字段上滚动(向上/向下)指定的时间量。 例如,要将当前日期上调三天,您可以致电roll(Calendar.DATE, 3) 。 如果该字段超过其最大允许值,它将“换行”回到最小值并继续滚动。 例如,在设置为“25 Av 5758”的希伯来语日历上调用roll(Calendar.DATE, 10)将导致日期“5 Av 5758”。
滚动某些字段时,其他字段的值可能会发生冲突并需要更改。 例如,当将日期“30 Av 5758”向上滚动MONTH字段时,必须调整DAY_OF_MONTH字段,以使结果为“29 Elul 5758”,而不是无效的“30 Elul”。
这种方法能滚动除了各个领域ERA , DST_OFFSET ,并ZONE_OFFSET 。 当然,子类可以在替代roll增加对其他字段的支持。
注意:您应始终使用roll和add而不是尝试直接在HebrewCalendar的字段上执行算术运算。 由于MONTH字段在非闰年行为不连续,因此简单算术可能会导致无效结果。
| 参数(Parameters) | |
|---|---|
field |
int: the time field. |
amount |
int: the amount by which the field should be rolled. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
if the field is invalid or refers to a field that cannot be handled by this method. |
void handleComputeFields (int julianDay)
子类可以重写此方法来计算特定于每个日历系统的几个字段。 这些是:
另外,子类应该计算任何子类特定的字段,即从BASE_FIELD_COUNT到getFieldCount() - 1的字段。
| 参数(Parameters) | |
|---|---|
julianDay |
int
|
int handleComputeMonthStart (int eyear,
int month,
boolean useMonth)
返回给定月/年开始的JD。
| 参数(Parameters) | |
|---|---|
eyear |
int: the extended year |
month |
int: the zero-based month, or 0 if useMonth is false |
useMonth |
boolean: if false, compute the day before the first day of the given year, otherwise, compute the day before the first day of the given month |
| 返回(Returns) | |
|---|---|
int |
the Julian day number of the day before the first day of the given month and year |
int handleGetExtendedYear ()
返回当前字段定义的扩展年份。 这将使用EXTENDED_YEAR字段或特定于日历系统的YEAR和超年字段(如ERA),具体取决于哪一组字段较新。
| 返回(Returns) | |
|---|---|
int |
the extended year |
int handleGetLimit (int field,
int limitType)
用于定义不同类型限制的子类API。 子类必须实现此方法才能返回以下字段的限制:
ERA YEAR MONTH WEEK_OF_YEAR WEEK_OF_MONTH DAY_OF_MONTH DAY_OF_YEAR DAY_OF_WEEK_IN_MONTH YEAR_WOY EXTENDED_YEAR
| 参数(Parameters) | |
|---|---|
field |
int: one of the above field numbers |
limitType |
int: one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM |
| 返回(Returns) | |
|---|---|
int |
|
int handleGetMonthLength (int extendedYear,
int month)
返回给定年份中给定月份的长度
| 参数(Parameters) | |
|---|---|
extendedYear |
int
|
month |
int
|
| 返回(Returns) | |
|---|---|
int |
|
int handleGetYearLength (int eyear)
返回给定希伯来语年的天数
| 参数(Parameters) | |
|---|---|
eyear |
int
|
| 返回(Returns) | |
|---|---|
int |
|