public class BuddhistCalendar extends GregorianCalendar
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
Calendar.getInstance(ULocale)
passing in a ULocale
with the tag "@calendar=buddhist"
.
Calendar
,
GregorianCalendar
,
Serialized FormCalendar.FormatConfiguration, Calendar.WeekData
Modifier and Type | Field and Description |
---|---|
static int |
BE
Constant for the Buddhist Era.
|
AD, BC, invertGregorian, isGregorian
AM, AM_PM, APRIL, AUGUST, BASE_FIELD_COUNT, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, EPOCH_JULIAN_DAY, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, GREATEST_MINIMUM, HOUR, HOUR_OF_DAY, INTERNALLY_SET, IS_LEAP_MONTH, JAN_1_1_JULIAN_DAY, JANUARY, JULIAN_DAY, JULY, JUNE, LEAST_MAXIMUM, MARCH, MAX_DATE, MAX_FIELD_COUNT, MAX_JULIAN, MAX_MILLIS, MAXIMUM, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MIN_DATE, MIN_JULIAN, MIN_MILLIS, MINIMUM, MINIMUM_USER_STAMP, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ORDINAL_MONTH, PM, RESOLVE_REMAP, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, UNSET, WALLTIME_FIRST, WALLTIME_LAST, WALLTIME_NEXT_VALID, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET
Constructor and Description |
---|
BuddhistCalendar()
Constructs a
BuddhistCalendar using the current time
in the default time zone with the default locale. |
BuddhistCalendar(Date date)
Constructs a
BuddhistCalendar with the given date set
in the default time zone with the default locale. |
BuddhistCalendar(int year,
int month,
int date)
Constructs a
BuddhistCalendar with the given date set
in the default time zone with the default locale. |
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.
|
BuddhistCalendar(Locale aLocale)
Constructs a
BuddhistCalendar based on the current time
in the default time zone with the given locale. |
BuddhistCalendar(TimeZone zone)
Constructs a
BuddhistCalendar based on the current time
in the given time zone with the default locale. |
BuddhistCalendar(TimeZone zone,
Locale aLocale)
Constructs a
BuddhistCalendar based on the current time
in the given time zone with 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. |
BuddhistCalendar(ULocale locale)
Constructs a
BuddhistCalendar based on the current time
in the default time zone with the given locale. |
Modifier and Type | Method and Description |
---|---|
String |
getType()
[icu] Returns the calendar type name string for this Calendar object.
|
protected void |
handleComputeFields(int julianDay)
Override Calendar to compute several fields specific to the hybrid
Gregorian-Julian calendar system.
|
protected int |
handleComputeMonthStart(int eyear,
int month,
boolean useMonth)
Return JD of start of given month/year
|
protected int |
handleGetExtendedYear()
Returns the extended year defined by the current fields.
|
protected int |
handleGetLimit(int field,
int limitType)
Override GregorianCalendar.
|
protected boolean |
isEra0CountingBackward()
Deprecated.
This API is ICU internal only.
|
getActualMaximum, getActualMinimum, getGregorianChange, handleComputeJulianDay, handleGetMonthLength, handleGetYearLength, hashCode, isEquivalentTo, isLeapYear, roll, setGregorianChange
add, after, before, clear, clear, clone, compareTo, complete, computeFields, computeGregorianFields, computeGregorianMonthStart, computeJulianDay, computeMillisInDay, computeMillisInDayLong, computeTime, computeZoneOffset, computeZoneOffset, equals, fieldDifference, fieldName, floorDivide, floorDivide, floorDivide, floorDivide, get, getAvailableLocales, getAvailableULocales, getDateAtTimePattern, getDateTimeFormat, getDateTimeFormat, getDateTimePattern, getDayOfWeekType, getDefaultDayInMonth, getDefaultMonthInYear, getDisplayName, getDisplayName, getFieldCount, getFieldResolutionTable, getFirstDayOfWeek, getGreatestMinimum, getGregorianDayOfMonth, getGregorianDayOfYear, getGregorianMonth, getGregorianYear, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getKeywordValuesForLocale, getLeastMaximum, getLimit, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getRelatedYear, getRepeatedWallTimeOption, getSkippedWallTimeOption, getStamp, getTemporalMonthCode, getTime, getTimeInMillis, getTimeZone, getWeekData, getWeekDataForRegion, getWeekendTransition, gregorianMonthLength, gregorianPreviousMonthLength, handleCreateFields, handleGetDateFormat, handleGetDateFormat, handleGetDateFormat, handleGetDateFormat, haveDefaultCentury, inTemporalLeapYear, internalGet, internalGet, internalGetMonth, internalGetMonth, internalGetTimeInMillis, internalSet, isGregorianLeapYear, isLenient, isSet, isWeekend, isWeekend, julianDayToDayOfWeek, julianDayToMillis, millisToJulianDay, newerField, newestStamp, pinField, prepareGetActual, resolveFields, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setRelatedYear, setRepeatedWallTimeOption, setSkippedWallTimeOption, setTemporalMonthCode, setTime, setTimeInMillis, setTimeZone, setWeekData, toString, validateField, validateField, validateFields, weekNumber, weekNumber
public static final int BE
ERA
value for the Buddhist calendar.Calendar.ERA
,
Constant Field Valuespublic BuddhistCalendar()
BuddhistCalendar
using the current time
in the default time zone with the default locale.public BuddhistCalendar(TimeZone zone)
BuddhistCalendar
based on the current time
in the given time zone with the default locale.zone
- the given time zone.public BuddhistCalendar(Locale aLocale)
BuddhistCalendar
based on the current time
in the default time zone with the given locale.aLocale
- the given locale.public BuddhistCalendar(ULocale locale)
BuddhistCalendar
based on the current time
in the default time zone with the given locale.locale
- the given ulocale.public BuddhistCalendar(TimeZone zone, Locale aLocale)
BuddhistCalendar
based on the current time
in the given time zone with the given locale.zone
- the given time zone.aLocale
- the given locale.public BuddhistCalendar(TimeZone zone, ULocale locale)
BuddhistCalendar
based on the current time
in the given time zone with the given locale.zone
- the given time zone.locale
- the given ulocale.public BuddhistCalendar(Date date)
BuddhistCalendar
with the given date set
in the default time zone with the default locale.date
- The date to which the new calendar is set.public BuddhistCalendar(int year, int month, int date)
BuddhistCalendar
with the given date set
in the default time zone with the default locale.public BuddhistCalendar(int year, int month, int date, int hour, int minute, int second)
year
- The value used to set the calendar's YEAR
time field.month
- The value used to set the calendar's MONTH
time field.
The value is 0-based. e.g., 0 for January.date
- The value used to set the calendar's DATE
time field.hour
- The value used to set the calendar's HOUR_OF_DAY
time field.minute
- The value used to set the calendar's MINUTE
time field.second
- The value used to set the calendar's SECOND
time field.protected int handleGetExtendedYear()
Calendar
handleGetExtendedYear
in class GregorianCalendar
protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)
GregorianCalendar
handleComputeMonthStart
in class GregorianCalendar
eyear
- the extended yearmonth
- the zero-based month, or 0 if useMonth is falseuseMonth
- if false, compute the day before the first day of
the given year, otherwise, compute the day before the first day of
the given monthprotected void handleComputeFields(int julianDay)
GregorianCalendar
handleComputeFields
in class GregorianCalendar
protected int handleGetLimit(int field, int limitType)
handleGetLimit
in class GregorianCalendar
field
- one of the above field numberslimitType
- one of MINIMUM
, GREATEST_MINIMUM
,
LEAST_MAXIMUM
, or MAXIMUM
public String getType()
See type="old type name" for the calendar attribute of locale IDs at http://www.unicode.org/reports/tr35/#Key_Type_Definitions
getType
in class GregorianCalendar
@Deprecated protected boolean isEra0CountingBackward()
isEra0CountingBackward
in class GregorianCalendar
Copyright © 2016 Unicode, Inc. and others.