Added in API level 24

BuddhistCalendar


open class BuddhistCalendar : GregorianCalendar
kotlin.Any
   ↳ 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 android.icu.util.Calendar#getInstance(ULocale) passing in a ULocale with the tag "@calendar=buddhist".

Summary

Constants
static Int

Constant for the Buddhist Era.

Inherited constants
Public constructors

Constructs a BuddhistCalendar using the current time in the default time zone with the default locale.

Constructs a BuddhistCalendar based on the current time in the given time zone with the default locale.

Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.

Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.

BuddhistCalendar(zone: TimeZone!, aLocale: Locale!)

Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.

BuddhistCalendar(zone: TimeZone!, locale: ULocale!)

Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.

Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.

BuddhistCalendar(year: Int, month: Int, date: Int)

Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.

BuddhistCalendar(year: Int, month: Int, date: Int, hour: Int, minute: Int, second: Int)

Constructs a BuddhistCalendar with the given date and time set for the default time zone with the default locale.

Public methods
open String!

[icu] Returns the calendar type name string for this Calendar object.

Protected methods
open Unit

open Int
handleComputeMonthStart(eyear: Int, month: Int, useMonth: Boolean)

open Int

open Int
handleGetLimit(field: Int, limitType: Int)

Override GregorianCalendar.

Inherited functions
Inherited properties

Constants

BE

Added in API level 24
static val BE: Int

Constant for the Buddhist Era. This is the only allowable ERA value for the Buddhist calendar.

Value: 0

Public constructors

BuddhistCalendar

Added in API level 24
BuddhistCalendar()

Constructs a BuddhistCalendar using the current time in the default time zone with the default locale.

BuddhistCalendar

Added in API level 24
BuddhistCalendar(zone: TimeZone!)

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

Added in API level 24
BuddhistCalendar(aLocale: Locale!)

Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.

Parameters
aLocale Locale!: the given locale.

BuddhistCalendar

Added in API level 24
BuddhistCalendar(locale: ULocale!)

Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.

Parameters
locale ULocale!: the given ulocale.

BuddhistCalendar

Added in API level 24
BuddhistCalendar(
    zone: TimeZone!,
    aLocale: 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.
aLocale Locale!: the given locale.

BuddhistCalendar

Added in API level 24
BuddhistCalendar(
    zone: TimeZone!,
    locale: ULocale!)

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

Added in API level 24
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

Added in API level 24
BuddhistCalendar(
    year: Int,
    month: Int,
    date: Int)

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

Added in API level 24
BuddhistCalendar(
    year: Int,
    month: Int,
    date: Int,
    hour: Int,
    minute: Int,
    second: Int)

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.

Public methods

getType

Added in API level 24
open fun getType(): String!

[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

Return
String! legacy calendar type name string

Protected methods

handleComputeFields

Added in API level 24
protected open fun handleComputeFields(julianDay: Int): Unit

handleComputeMonthStart

Added in API level 24
protected open fun handleComputeMonthStart(
    eyear: Int,
    month: Int,
    useMonth: Boolean
): Int
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
Return
Int the Julian day number of the day before the first day of the given month and year

handleGetExtendedYear

Added in API level 24
protected open fun handleGetExtendedYear(): Int
Return
Int the extended year

handleGetLimit

Added in API level 24
protected open fun handleGetLimit(
    field: Int,
    limitType: Int
): Int

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