public
class
BuddhistCalendar
extends GregorianCalendar
java.lang.Object | |||
↳ | android.icu.util.Calendar | ||
↳ | android.icu.util.GregorianCalendar | ||
↳ | android.icu.util.BuddhistCalendar |
BuddhistCalendar
is a subclass of GregorianCalendar
that numbers years since the birth of the Buddha. This is the civil calendar
in some predominantly Buddhist countries such as Thailand, and it is used for
religious purposes elsewhere.
The Buddhist calendar is identical to the Gregorian calendar in all respects except for the year and era. Years are numbered since the birth of the Buddha in 543 BC (Gregorian), so that 1 AD (Gregorian) is equivalent to 544 BE (Buddhist Era) and 1998 AD is 2541 BE.
The Buddhist Calendar has only one allowable era: BE
. If the
calendar is not in lenient mode (see setLenient
), dates before
1/1/1 BE are rejected with an IllegalArgumentException
.
This class should not be subclassed.
BuddhistCalendar usually should be instantiated using
getInstance(ULocale)
passing in a ULocale
with the tag "@calendar=buddhist"
.
See also:
Constants | |
---|---|
int |
BE
Constant for the Buddhist Era. |
Inherited constants |
---|
From
class
android.icu.util.GregorianCalendar
|
From
class
android.icu.util.Calendar
|
Inherited fields |
---|
From
class
android.icu.util.GregorianCalendar
|
From
class
android.icu.util.Calendar
|
Public constructors | |
---|---|
BuddhistCalendar()
Constructs a |
|
BuddhistCalendar(TimeZone zone)
Constructs a |
|
BuddhistCalendar(Locale aLocale)
Constructs a |
|
BuddhistCalendar(ULocale locale)
Constructs a |
|
BuddhistCalendar(TimeZone zone, Locale aLocale)
Constructs a |
|
BuddhistCalendar(TimeZone zone, ULocale locale)
Constructs a |
|
BuddhistCalendar(Date date)
Constructs a |
|
BuddhistCalendar(int year, int month, int date)
Constructs a |
|
BuddhistCalendar(int year, int month, int date, int hour, int minute, int second)
Constructs a BuddhistCalendar with the given date and time set for the default time zone with the default locale. |
Public methods | |
---|---|
String
|
getType()
[icu] Returns the calendar type name string for this Calendar object. |
Protected methods | |
---|---|
void
|
handleComputeFields(int julianDay)
Override Calendar to compute several fields specific to the hybrid Gregorian-Julian calendar system. |
int
|
handleComputeMonthStart(int eyear, int month, boolean useMonth)
Return JD of start of given month/year |
int
|
handleGetExtendedYear()
Returns the extended year defined by the current fields. |
int
|
handleGetLimit(int field, int limitType)
Override GregorianCalendar. |
Inherited methods | |
---|---|
From
class
android.icu.util.GregorianCalendar
| |
From
class
android.icu.util.Calendar
| |
From
class
java.lang.Object
| |
From
interface
java.lang.Comparable
|
int BE
Constant for the Buddhist Era. This is the only allowable ERA
value for the Buddhist calendar.
See also:
Constant Value: 0 (0x00000000)
BuddhistCalendar ()
Constructs a BuddhistCalendar
using the current time
in the default time zone with the default locale.
BuddhistCalendar (TimeZone zone)
Constructs a BuddhistCalendar
based on the current time
in the given time zone with the default locale.
Parameters | |
---|---|
zone |
TimeZone :
the given time zone.
|
BuddhistCalendar (Locale aLocale)
Constructs a BuddhistCalendar
based on the current time
in the default time zone with the given locale.
Parameters | |
---|---|
aLocale |
Locale :
the given locale.
|
BuddhistCalendar (ULocale locale)
Constructs a BuddhistCalendar
based on the current time
in the default time zone with the given locale.
Parameters | |
---|---|
locale |
ULocale :
the given ulocale.
|
BuddhistCalendar (TimeZone zone, Locale aLocale)
Constructs a BuddhistCalendar
based on the current time
in the given time zone with the given locale.
Parameters | |
---|---|
zone |
TimeZone :
the given time zone. |
aLocale |
Locale :
the given locale.
|
BuddhistCalendar (TimeZone zone, ULocale locale)
Constructs a BuddhistCalendar
based on the current time
in the given time zone with the given locale.
Parameters | |
---|---|
zone |
TimeZone :
the given time zone. |
locale |
ULocale :
the given ulocale.
|
BuddhistCalendar (Date date)
Constructs a BuddhistCalendar
with the given date set
in the default time zone with the default locale.
Parameters | |
---|---|
date |
Date :
The date to which the new calendar is set.
|
BuddhistCalendar (int year, int month, int date)
Constructs a BuddhistCalendar
with the given date set
in the default time zone with the default locale.
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 January. |
date |
int :
The value used to set the calendar's DATE time field.
|
BuddhistCalendar (int year, int month, int date, int hour, int minute, int second)
Constructs a BuddhistCalendar with the given date and time set for the default time zone with the default locale.
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 January. |
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.
|
String getType ()
[icu] Returns the calendar type name string for this Calendar object. The returned string is the legacy ICU calendar attribute value, for example, "gregorian" or "japanese".
See type="old type name" for the calendar attribute of locale IDs at http://www.unicode.org/reports/tr35/#Key_Type_Definitions
Returns | |
---|---|
String |
legacy calendar type name string |
void handleComputeFields (int julianDay)
Override Calendar to compute several fields specific to the hybrid Gregorian-Julian calendar system. These are:
Parameters | |
---|---|
julianDay |
int
|
int handleComputeMonthStart (int eyear, int month, boolean useMonth)
Return JD of start of given month/year
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 ()
Returns the extended year defined by the current fields. This will use the EXTENDED_YEAR field or the YEAR and supra-year fields (such as ERA) specific to the calendar system, depending on which set of fields is newer.
Returns | |
---|---|
int |
the extended year |
int handleGetLimit (int field, int limitType)
Override GregorianCalendar. There is only one Buddhist ERA. We should really handle YEAR, YEAR_WOY, and EXTENDED_YEAR here too to implement the 1..5000000 range, but it's not critical.
Parameters | |
---|---|
field |
int :
one of the above field numbers |
limitType |
int :
one of MINIMUM , GREATEST_MINIMUM ,
LEAST_MAXIMUM , or MAXIMUM
|
Returns | |
---|---|
int |