ChineseCalendar Class

Definition

ChineseCalendar is a concrete subclass of Calendar that implements a traditional Chinese calendar.

[Android.Runtime.Register("android/icu/util/ChineseCalendar", ApiSince=24, DoNotGenerateAcw=true)]
public class ChineseCalendar : Android.Icu.Util.Calendar
[<Android.Runtime.Register("android/icu/util/ChineseCalendar", ApiSince=24, DoNotGenerateAcw=true)>]
type ChineseCalendar = class
    inherit Calendar
Inheritance
ChineseCalendar
Attributes

Remarks

ChineseCalendar is a concrete subclass of Calendar that implements a traditional Chinese calendar. The traditional Chinese calendar is a lunisolar calendar: Each month starts on a new moon, and the months are numbered according to solar events, specifically, to guarantee that month 11 always contains the winter solstice. In order to accomplish this, leap months are inserted in certain years. Leap months are numbered the same as the month they follow. The decision of which month is a leap month depends on the relative movements of the sun and moon.

All astronomical computations are performed with respect to a time zone of GMT+8:00 and a longitude of 120 degrees east. Although some calendars implement a historically more accurate convention of using Beijing's local longitude (116 degrees 25 minutes east) and time zone (GMT+7:45:40) for dates before 1929, we do not implement this here.

Years are counted in two different ways in the Chinese calendar. The first method is by sequential numbering from the 61st year of the reign of Huang Di, 2637 BCE, which is designated year 1 on the Chinese calendar. The second method uses 60-year cycles from the same starting point, which is designated year 1 of cycle 1. In this class, the EXTENDED_YEAR field contains the sequential year count. The ERA field contains the cycle number, and the YEAR field contains the year of the cycle, a value between 1 and 60.

There is some variation in what is considered the starting point of the calendar, with some sources starting in the first year of the reign of Huang Di, rather than the 61st. This gives continuous year numbers 60 years greater and cycle numbers one greater than what this class implements.

Because ChineseCalendar defines an additional field and redefines the way the ERA field is used, it requires a new format class, ChineseDateFormat. As always, use the methods DateFormat.getXxxInstance(Calendar cal,...) to obtain a formatter for this calendar.

References:<ul>

<li>Dershowitz and Reingold, Calendrical Calculations, Cambridge University Press, 1997</li>

<li>The Calendar FAQ</li>

</ul>

This class should not be subclassed.

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

Java documentation for android.icu.util.ChineseCalendar.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

ChineseCalendar()

Construct a ChineseCalendar with the default time zone and locale.

ChineseCalendar(Date)

Construct a ChineseCalendar with the give date set in the default time zone with the default locale.

ChineseCalendar(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

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

ChineseCalendar(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

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

ChineseCalendar(Int32, Int32, Int32, Int32, Int32)

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

ChineseCalendar(Int32, Int32, Int32, Int32)

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

ChineseCalendar(IntPtr, JniHandleOwnership)
ChineseCalendar(Locale)

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

ChineseCalendar(TimeZone, Locale)

Construct a ChineseCalendar based on the current time in the given time zone with the given locale.

ChineseCalendar(TimeZone, ULocale)

Construct a ChineseCalendar based on the current time with the given time zone with the given locale.

ChineseCalendar(TimeZone)

Construct a ChineseCalendar based on the current time in the given time zone with the default FORMAT locale.

ChineseCalendar(ULocale)

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

Fields

Am

Value of the AM_PM field indicating the period of the day from midnight to just before noon.

(Inherited from Calendar)
AmPm
Obsolete.

Field number for get and set indicating whether the HOUR is before or after noon.

(Inherited from Calendar)
April

Value of the MONTH field indicating the fourth month of the year.

(Inherited from Calendar)
August

Value of the MONTH field indicating the eighth month of the year.

(Inherited from Calendar)
BaseFieldCount

The number of fields defined by this class.

(Inherited from Calendar)
Date
Obsolete.

Field number for get and set indicating the day of the month.

(Inherited from Calendar)
DayOfMonth
Obsolete.

Field number for get and set indicating the day of the month.

(Inherited from Calendar)
DayOfWeek
Obsolete.

Field number for get and set indicating the day of the week.

(Inherited from Calendar)
DayOfWeekInMonth
Obsolete.

Field number for get and set indicating the ordinal number of the day of the week within the current month.

(Inherited from Calendar)
DayOfYear
Obsolete.

Field number for get and set indicating the day number within the current year.

(Inherited from Calendar)
December

Value of the MONTH field indicating the twelfth month of the year.

(Inherited from Calendar)
DowLocal
Obsolete.

<strong>[icu]</strong> Field number for get() and set() indicating the localized day of week.

(Inherited from Calendar)
DstOffset
Obsolete.

Field number for get and set indicating the daylight savings offset in milliseconds.

(Inherited from Calendar)
EpochJulianDay

The Julian day of the epoch, that is, January 1, 1970 on the Gregorian calendar.

(Inherited from Calendar)
Era
Obsolete.

Field number for get and set indicating the era, e.

(Inherited from Calendar)
ExtendedYear
Obsolete.

<strong>[icu]</strong> Field number for get() and set() indicating the extended year.

(Inherited from Calendar)
February

Value of the MONTH field indicating the second month of the year.

(Inherited from Calendar)
Friday

Value of the DAY_OF_WEEK field indicating Friday.

(Inherited from Calendar)
GreatestMinimum

Limit type for getLimit() and handleGetLimit() indicating the greatest minimum value that a field can take.

(Inherited from Calendar)
Hour
Obsolete.

Field number for get and set indicating the hour of the morning or afternoon.

(Inherited from Calendar)
HourOfDay
Obsolete.

Field number for get and set indicating the hour of the day.

(Inherited from Calendar)
InternallySet

Value of the time stamp stamp[] indicating that a field has been set via computations from the time or from other fields.

(Inherited from Calendar)
IsLeapMonth

<strong>[icu]</strong> Field indicating whether or not the current month is a leap month.

(Inherited from Calendar)
Jan11JulianDay

The Julian day of the Gregorian epoch, that is, January 1, 1 on the Gregorian calendar.

(Inherited from Calendar)
January

Value of the MONTH field indicating the first month of the year.

(Inherited from Calendar)
JulianDay
Obsolete.

<strong>[icu]</strong> Field number for get() and set() indicating the modified Julian day number.

(Inherited from Calendar)
July

Value of the MONTH field indicating the seventh month of the year.

(Inherited from Calendar)
June

Value of the MONTH field indicating the sixth month of the year.

(Inherited from Calendar)
LeastMaximum

Limit type for getLimit() and handleGetLimit() indicating the least maximum value that a field can take.

(Inherited from Calendar)
March

Value of the MONTH field indicating the third month of the year.

(Inherited from Calendar)
MaxFieldCount

The maximum number of fields possible.

(Inherited from Calendar)
Maximum

Limit type for getLimit() and handleGetLimit() indicating the maximum value that a field can take (greatest maximum).

(Inherited from Calendar)
MaxJulian

The maximum supported Julian day.

(Inherited from Calendar)
MaxMillis

The maximum supported epoch milliseconds.

(Inherited from Calendar)
May

Value of the MONTH field indicating the fifth month of the year.

(Inherited from Calendar)
Millisecond
Obsolete.

Field number for get and set indicating the millisecond within the second.

(Inherited from Calendar)
MillisecondsInDay
Obsolete.

<strong>[icu]</strong> Field number for get() and set() indicating the milliseconds in the day.

(Inherited from Calendar)
Minimum

Limit type for getLimit() and handleGetLimit() indicating the minimum value that a field can take (least minimum).

(Inherited from Calendar)
MinimumUserStamp

If the time stamp stamp[] has a value greater than or equal to MINIMUM_USER_SET then it has been set by the user via a call to set().

(Inherited from Calendar)
MinJulian

The minimum supported Julian day.

(Inherited from Calendar)
MinMillis

The minimum supported epoch milliseconds.

(Inherited from Calendar)
Minute
Obsolete.

Field number for get and set indicating the minute within the hour.

(Inherited from Calendar)
Monday

Value of the DAY_OF_WEEK field indicating Monday.

(Inherited from Calendar)
Month
Obsolete.

Field number for get and set indicating the month.

(Inherited from Calendar)
November

Value of the MONTH field indicating the eleventh month of the year.

(Inherited from Calendar)
October

Value of the MONTH field indicating the tenth month of the year.

(Inherited from Calendar)
OneDay

The number of milliseconds in one day.

(Inherited from Calendar)
OneHour

The number of milliseconds in one hour.

(Inherited from Calendar)
OneMinute

The number of milliseconds in one minute.

(Inherited from Calendar)
OneSecond

The number of milliseconds in one second.

(Inherited from Calendar)
OneWeek

The number of milliseconds in one week.

(Inherited from Calendar)
Pm

Value of the AM_PM field indicating the period of the day from noon to just before midnight.

(Inherited from Calendar)
ResolveRemap

Value to OR against resolve table field values for remapping.

(Inherited from Calendar)
Saturday

Value of the DAY_OF_WEEK field indicating Saturday.

(Inherited from Calendar)
Second
Obsolete.

Field number for get and set indicating the second within the minute.

(Inherited from Calendar)
September

Value of the MONTH field indicating the ninth month of the year.

(Inherited from Calendar)
Sunday

Value of the DAY_OF_WEEK field indicating Sunday.

(Inherited from Calendar)
Thursday

Value of the DAY_OF_WEEK field indicating Thursday.

(Inherited from Calendar)
Tuesday

Value of the DAY_OF_WEEK field indicating Tuesday.

(Inherited from Calendar)
Undecimber

Value of the MONTH field indicating the thirteenth month of the year.

(Inherited from Calendar)
Unset

Value of the time stamp stamp[] indicating that a field has not been set since the last call to clear().

(Inherited from Calendar)
WalltimeFirst
Obsolete.

<strong>[icu]</strong>Option used by #setRepeatedWallTimeOption(int) and #setSkippedWallTimeOption(int) specifying an ambiguous wall time to be interpreted as the earliest.

(Inherited from Calendar)
WalltimeLast
Obsolete.

<strong>[icu]</strong>Option used by #setRepeatedWallTimeOption(int) and #setSkippedWallTimeOption(int) specifying an ambiguous wall time to be interpreted as the latest.

(Inherited from Calendar)
WalltimeNextValid
Obsolete.

<strong>[icu]</strong>Option used by #setSkippedWallTimeOption(int) specifying an ambiguous wall time to be interpreted as the next valid wall time.

(Inherited from Calendar)
Wednesday

Value of the DAY_OF_WEEK field indicating Wednesday.

(Inherited from Calendar)
WeekOfMonth
Obsolete.

Field number for get and set indicating the week number within the current month.

(Inherited from Calendar)
WeekOfYear
Obsolete.

Field number for get and set indicating the week number within the current year.

(Inherited from Calendar)
Year
Obsolete.

Field number for get and set indicating the year.

(Inherited from Calendar)
YearWoy
Obsolete.

<strong>[icu]</strong> Field number for get() and set() indicating the extended year corresponding to the #WEEK_OF_YEAR field.

(Inherited from Calendar)
ZoneOffset
Obsolete.

Field number for get and set indicating the raw offset from GMT in milliseconds.

(Inherited from Calendar)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
FieldCount

<strong>[icu]</strong> Returns the number of fields defined by this calendar.

(Inherited from Calendar)
FirstDayOfWeek

Returns what the first day of the week is, where 1 = #SUNDAY and 7 = #SATURDAY. -or- Sets what the first day of the week is, where 1 = #SUNDAY and 7 = #SATURDAY.

(Inherited from Calendar)
GregorianDayOfMonth

Returns the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().

(Inherited from Calendar)
GregorianDayOfYear

Returns the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().

(Inherited from Calendar)
GregorianMonth

Returns the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().

(Inherited from Calendar)
GregorianYear

Returns the extended year on the Gregorian calendar as computed by computeGregorianFields().

(Inherited from Calendar)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsWeekend

<strong>[icu]</strong> Returns true if this Calendar's current date and time is in the weekend in this calendar system.

(Inherited from Calendar)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Lenient

Tell whether date/time interpretation is to be lenient. -or- Specify whether or not date/time interpretation is to be lenient.

(Inherited from Calendar)
MinimalDaysInFirstWeek

Returns what the minimal days required in the first week of the year are. -or- Sets what the minimal days required in the first week of the year are.

(Inherited from Calendar)
PeerReference (Inherited from Object)
RepeatedWallTimeOption

<strong>[icu]</strong>Gets the behavior for handling wall time repeating multiple times at negative time zone offset transitions. -or- <strong>[icu]</strong>Sets the behavior for handling wall time repeating multiple times at negative time zone offset transitions.

(Inherited from Calendar)
SkippedWallTimeOption

<strong>[icu]</strong>Gets the behavior for handling skipped wall time at positive time zone offset transitions. -or- <strong>[icu]</strong>Sets the behavior for handling skipped wall time at positive time zone offset transitions.

(Inherited from Calendar)
ThresholdClass
ThresholdType
Time

Returns this Calendar's current time. -or- Sets this Calendar's current time with the given Date.

(Inherited from Calendar)
TimeInMillis

Returns this Calendar's current time as a long. -or- Sets this Calendar's current time from the given long value.

(Inherited from Calendar)
TimeZone

Returns the time zone. -or- Sets the time zone with the given time zone value.

(Inherited from Calendar)
Type

<strong>[icu]</strong> Returns the calendar type name string for this Calendar object.

(Inherited from Calendar)

Methods

Add(CalendarField, Int32)

Add a signed amount to a specified field, using this calendar's rules.

(Inherited from Calendar)
After(Object)

Compares the time field records.

(Inherited from Calendar)
Before(Object)

Compares the time field records.

(Inherited from Calendar)
Clear()

Clears the values of all the time fields.

(Inherited from Calendar)
Clear(CalendarField)

Clears the value in the given time field.

(Inherited from Calendar)
Clone()

Overrides Cloneable

(Inherited from Calendar)
CompareTo(Calendar)

Compares the times (in millis) represented by two Calendar objects.

(Inherited from Calendar)
Complete()

Fills in any unset fields in the time field list.

(Inherited from Calendar)
ComputeFields()

Converts the current millisecond time value time to field values in fields[].

(Inherited from Calendar)
ComputeGregorianFields(Int32)

Compute the Gregorian calendar year, month, and day of month from the Julian day.

(Inherited from Calendar)
ComputeGregorianMonthStart(Int32, Int32)

Compute the Julian day of a month of the Gregorian calendar.

(Inherited from Calendar)
ComputeJulianDay()

Compute the Julian day number as specified by this calendar's fields.

(Inherited from Calendar)
ComputeMillisInDay()

Compute the milliseconds in the day from the fields.

(Inherited from Calendar)
ComputeTime()

Converts the current field values in fields[] to the millisecond time value time.

(Inherited from Calendar)
ComputeZoneOffset(Int64, Int32)

This method can assume EXTENDED_YEAR has been set.

(Inherited from Calendar)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FieldDifference(Date, CalendarField)

<strong>[icu]</strong> Returns the difference between the given time and the time this calendar object is set to.

(Inherited from Calendar)
FieldName(CalendarField)

Returns a string name for a field, for debugging and exceptions.

(Inherited from Calendar)
Get(CalendarField)

Returns the value for a given time field.

(Inherited from Calendar)
GetActualMaximum(CalendarField)

Returns the maximum value that this field could have, given the current date.

(Inherited from Calendar)
GetActualMinimum(CalendarField)

Returns the minimum value that this field could have, given the current date.

(Inherited from Calendar)
GetDateTimeFormat(DateFormatStyle, Int32, Locale)

<strong>[icu]</strong> Returns a DateFormat appropriate to this calendar.

(Inherited from Calendar)
GetDateTimeFormat(DateFormatStyle, Int32, ULocale)

<strong>[icu]</strong> Returns a DateFormat appropriate to this calendar.

(Inherited from Calendar)
GetDisplayName(Locale)

Returns the name of this calendar in the language of the given locale.

(Inherited from Calendar)
GetDisplayName(ULocale)

Returns the name of this calendar in the language of the given locale.

(Inherited from Calendar)
GetFieldResolutionTable()

Returns the field resolution array for this calendar.

(Inherited from Calendar)
GetGreatestMinimum(CalendarField)

Returns the highest minimum value for the given field if varies.

(Inherited from Calendar)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLeastMaximum(CalendarField)

Returns the lowest maximum value for the given field if varies.

(Inherited from Calendar)
GetLimit(CalendarField, Int32)

Returns a limit for a field.

(Inherited from Calendar)
GetMaximum(CalendarField)

Returns the maximum value for the given time field.

(Inherited from Calendar)
GetMinimum(CalendarField)

Returns the minimum value for the given time field.

(Inherited from Calendar)
GetStamp(CalendarField)

Returns the timestamp of a field.

(Inherited from Calendar)
GetWeekData() (Inherited from Calendar)
HandleComputeFields(Int32)

Subclasses may override this method to compute several fields specific to each calendar system.

(Inherited from Calendar)
HandleComputeJulianDay(Int32)

Subclasses may override this.

(Inherited from Calendar)
HandleComputeMonthStart(Int32, Int32, Boolean)

Return the Julian day number of day before the first day of the given month in the given extended year.

HandleCreateFields()

Subclasses that use additional fields beyond those defined in Calendar should override this method to return an int[] array of the appropriate length.

(Inherited from Calendar)
HandleGetDateFormat(String, Locale)

Creates a DateFormat appropriate to this calendar.

(Inherited from Calendar)
HandleGetDateFormat(String, String, Locale)

Creates a DateFormat appropriate to this calendar.

(Inherited from Calendar)
HandleGetDateFormat(String, String, ULocale)

To be added

HandleGetDateFormat(String, ULocale)

Creates a DateFormat appropriate to this calendar.

(Inherited from Calendar)
HandleGetExtendedYear()

Implement abstract Calendar method to return the extended year defined by the current fields.

HandleGetLimit(CalendarField, Int32)

Override Calendar to return the limit value for the given field.

HandleGetMonthLength(Int32, Int32)

Returns the number of days in the given month of the given extended year of this calendar system.

(Inherited from Calendar)
HandleGetYearLength(Int32)

Returns the number of days in the given extended year of this calendar system.

(Inherited from Calendar)
InternalGet(CalendarField, Int32)

Returns the value for a given time field, or return the given default value if the field is not set.

(Inherited from Calendar)
InternalGet(CalendarField)

Returns the value for a given time field.

(Inherited from Calendar)
InternalGetTimeInMillis()

Returns the current milliseconds without recomputing.

(Inherited from Calendar)
InternalSet(CalendarField, Int32)

Set a field to a value.

(Inherited from Calendar)
InvokeIsWeekend(Date)

<strong>[icu]</strong> Returns true if the given date and time is in the weekend in this calendar system.

(Inherited from Calendar)
IsEquivalentTo(Calendar)

<strong>[icu]</strong> Returns true if the given Calendar object is equivalent to this one.

(Inherited from Calendar)
IsSet(CalendarField)

Determines if the given time field has a value set.

(Inherited from Calendar)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
NewerField(Int32, Int32)

Returns the field that is newer, either defaultField, or alternateField.

(Inherited from Calendar)
NewestStamp(Int32, Int32, Int32)

Returns the newest stamp of a given range of fields.

(Inherited from Calendar)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PinField(CalendarField)

Adjust the specified field so that it is within the allowable range for the date to which this calendar is set.

(Inherited from Calendar)
PrepareGetActual(CalendarField, Boolean)

Prepare this calendar for computing the actual minimum or maximum.

(Inherited from Calendar)
ResolveFields(Int32[][][])

Given a precedence table, return the newest field combination in the table, or -1 if none is found.

(Inherited from Calendar)
Roll(CalendarField, Boolean)

Rolls (up/down) a single unit of time on the given field.

(Inherited from Calendar)
Roll(CalendarField, Int32)

Rolls (up/down) a specified amount time on the given field.

(Inherited from Calendar)
Set(CalendarField, Int32)

Sets the time field with the given value.

(Inherited from Calendar)
Set(Int32, Int32, Int32, Int32, Int32, Int32)

Sets the values for the fields year, month, date, hour, minute, and second.

(Inherited from Calendar)
Set(Int32, Int32, Int32, Int32, Int32)

Sets the values for the fields year, month, date, hour, and minute.

(Inherited from Calendar)
Set(Int32, Int32, Int32)

Sets the values for the fields year, month, and date.

(Inherited from Calendar)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetWeekData(Calendar+WeekData) (Inherited from Calendar)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
ValidateField(CalendarField, Int32, Int32)

Validate a single field of this calendar given its minimum and maximum allowed value.

(Inherited from Calendar)
ValidateField(CalendarField)

Validate a single field of this calendar.

(Inherited from Calendar)
ValidateFields()

Ensure that each field is within its valid range by calling #validateField(int) on each field that has been set.

(Inherited from Calendar)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WeekNumber(Int32, Int32, Int32)

Returns the week number of a day, within a period.

(Inherited from Calendar)
WeekNumber(Int32, Int32)

Returns the week number of a day, within a period.

(Inherited from Calendar)

Explicit Interface Implementations

IComparable.CompareTo(Object) (Inherited from Calendar)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to