Added in API level 24

TaiwanCalendar

open class TaiwanCalendar : GregorianCalendar
kotlin.Any
   ↳ android.icu.util.Calendar
   ↳ android.icu.util.GregorianCalendar
   ↳ android.icu.util.TaiwanCalendar

TaiwanCalendar is a subclass of GregorianCalendar that numbers years since 1912.

The Taiwan calendar is identical to the Gregorian calendar in all respects except for the year and era. Years are numbered since 1912 AD (Gregorian).

The Taiwan Calendar has one era: MINGUO.

This class should not be subclassed.

TaiwanCalendar usually should be instantiated using android.icu.util.Calendar#getInstance(ULocale) passing in a ULocale with the tag "@calendar=roc".

Summary

Constants
static Int

Constant for the Taiwan Era for years before Minguo 1.

static Int

Constant for the Taiwan Era for Minguo.

Inherited constants
Public constructors

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

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

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

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

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

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

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

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

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

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

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

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

Constructs a TaiwanCalendar 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

Override Calendar to compute several fields specific to the hybrid Gregorian-Julian calendar system.

open Int

Returns the extended year defined by the current fields.

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

Override GregorianCalendar.

Inherited functions
Inherited properties

Constants

BEFORE_MINGUO

Added in API level 24
static val BEFORE_MINGUO: Int

Constant for the Taiwan Era for years before Minguo 1. Before Minuo 1 is Gregorian 1911, Before Minguo 2 is Gregorian 1910 and so on.

Value: 0

MINGUO

Added in API level 24
static val MINGUO: Int

Constant for the Taiwan Era for Minguo. Minguo 1 is 1912 in Gregorian calendar.

Value: 1

Public constructors

TaiwanCalendar

Added in API level 24
TaiwanCalendar()

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

TaiwanCalendar

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

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

Parameters
zone TimeZone!: the given time zone.

TaiwanCalendar

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

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

Parameters
aLocale Locale!: the given locale.

TaiwanCalendar

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

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

Parameters
locale ULocale!: the given ulocale.

TaiwanCalendar

Added in API level 24
TaiwanCalendar(
    zone: TimeZone!,
    aLocale: Locale!)

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

Parameters
zone TimeZone!: the given time zone.

TaiwanCalendar

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

Constructs a TaiwanCalendar 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.

TaiwanCalendar

Added in API level 24
TaiwanCalendar(date: Date!)

Constructs a TaiwanCalendar 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.

TaiwanCalendar

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

Constructs a TaiwanCalendar 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.

TaiwanCalendar

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

Constructs a TaiwanCalendar 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

Override Calendar to compute several fields specific to the hybrid Gregorian-Julian calendar system. These are:

  • ERA
  • YEAR
  • MONTH
  • DAY_OF_MONTH
  • DAY_OF_YEAR
  • EXTENDED_YEAR

handleGetExtendedYear

Added in API level 24
protected open fun handleGetExtendedYear(): Int

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.

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 Taiwan 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