Calendar Calendar Class

Definition

Calendar is an abstract base class for converting between a Date object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on.

[Android.Runtime.Register("java/util/Calendar", ApiSince=1, DoNotGenerateAcw=true)]
public abstract class Calendar : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Lang.ICloneable, Java.Lang.IComparable
type Calendar = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface ICloneable
    interface IComparable
Inheritance
CalendarCalendar
Derived
Attributes
Implements

Remarks

Android platform documentation

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

Calendar() Calendar()

Constructs a Calendar instance using the default TimeZone and Locale.

Calendar(IntPtr, JniHandleOwnership) Calendar(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Calendar(TimeZone, Locale) Calendar(TimeZone, Locale)

Constructs a Calendar instance using the given TimeZone and Locale.

Fields

AllStyles AllStyles
Am Am

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

AmPm AmPm

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

April April

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

August August

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

Date Date

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

DayOfMonth DayOfMonth

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

DayOfWeek DayOfWeek

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

DayOfWeekInMonth DayOfWeekInMonth

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

DayOfYear DayOfYear

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

December December

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

DstOffset DstOffset

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

Era Era

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

February February

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

FieldCount FieldCount

This is the total number of fields in this calendar.

Friday Friday

Value of the DAY_OF_WEEK field indicating Friday.

Hour Hour

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

HourOfDay HourOfDay

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

January January

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

July July

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

June June

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

Long Long
LongFormat LongFormat
LongStandalone LongStandalone
March March

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

May May

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

Millisecond Millisecond

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

Minute Minute

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

Monday Monday

Value of the DAY_OF_WEEK field indicating Monday.

Month Month

Field number for get and set indicating the month.

NarrowFormat NarrowFormat
NarrowStandalone NarrowStandalone
November November

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

October October

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

Pm Pm

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

Saturday Saturday

Value of the DAY_OF_WEEK field indicating Saturday.

Second Second

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

September September

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

Short Short
ShortFormat ShortFormat
ShortStandalone ShortStandalone
Sunday Sunday

Value of the DAY_OF_WEEK field indicating Sunday.

Thursday Thursday

Value of the DAY_OF_WEEK field indicating Thursday.

Tuesday Tuesday

Value of the DAY_OF_WEEK field indicating Tuesday.

Undecimber Undecimber

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

Wednesday Wednesday

Value of the DAY_OF_WEEK field indicating Wednesday.

WeekOfMonth WeekOfMonth

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

WeekOfYear WeekOfYear

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

Year Year

Field number for get and set indicating the year.

ZoneOffset ZoneOffset

Field number for get and set indicating the raw (non-DST) offset from GMT in milliseconds.

Properties

AreFieldsSet AreFieldsSet

True iff the values in fields[] correspond to time.

AvailableCalendarTypes AvailableCalendarTypes
CalendarType CalendarType
Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Fields Fields

Contains broken-down field values for the current value of time if areFieldsSet is true, or stale data corresponding to some previous value otherwise.

FirstDayOfWeek FirstDayOfWeek

Returns the first day of the week for this Calendar.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
Instance Instance

Constructs a new instance of the Calendar subclass appropriate for the default Locale and default TimeZone, set to the current date and time.

IsTimeSet IsTimeSet

Whether time corresponds to the values in fields[].

IsWeekDateSupported IsWeekDateSupported
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
Lenient Lenient

Tests whether this Calendar accepts field values which are outside the valid range for the field.

MinimalDaysInFirstWeek MinimalDaysInFirstWeek

Returns the minimal days in the first week of the year.

PeerReference PeerReference Inherited from Object
ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Time Time

Returns the time of this Calendar as a Date object.

TimeInMillis TimeInMillis

Returns the time represented by this Calendar, recomputing the time from its fields if necessary.

TimeZone TimeZone

Returns the time zone used by this Calendar.

WeeksInWeekYear WeeksInWeekYear
WeekYear WeekYear

Methods

Add(CalendarField, Int32) Add(CalendarField, Int32)

Adds the given amount to a Calendar field.

After(Object) After(Object)

Returns whether the Date represented by this Calendar instance is after the Date represented by the parameter.

Before(Object) Before(Object)

Returns whether the Date represented by this Calendar instance is before the Date represented by the parameter.

Clear() Clear()

Clears the values of all the time fields, marking them all unset and assigning them all a value of zero.

Clear(CalendarField) Clear(CalendarField)

Clears the value in the given time field, marking it unset and assigning it a value of zero.

Clone() Clone()

Returns a partially deep copy of this Calendar; all fields from from the Calendar class are cloned (deep copy) but fields from subclasses aren't (shallow copy).

CompareTo(Calendar) CompareTo(Calendar)

Compares the time represented by this Calendar to that represented by the given Calendar.

Complete() Complete()

Computes the time from the fields if the time has not already been set.

ComputeFields() ComputeFields()

Computes the Calendar fields from time.

ComputeTime() ComputeTime()

Computes time from the Calendar fields.

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

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
Get(CalendarField) Get(CalendarField)

Returns the value of the given field after computing the field values by calling complete() first.

GetActualMaximum(CalendarField) GetActualMaximum(CalendarField)

Returns the maximum value of the given field for the current date.

GetActualMinimum(CalendarField) GetActualMinimum(CalendarField)

Returns the minimum value of the given field for the current date.

GetAvailableLocales() GetAvailableLocales()

Returns an array of locales for which custom Calendar instances are available.

GetDisplayName(Int32, Int32, Locale) GetDisplayName(Int32, Int32, Locale)

Returns a human-readable string for the value of field using the given style and locale.

GetDisplayNames(Int32, Int32, Locale) GetDisplayNames(Int32, Int32, Locale)

Returns a map of human-readable strings to corresponding values, for the given field, style, and locale.

GetGreatestMinimum(CalendarField) GetGreatestMinimum(CalendarField)

Returns the greatest minimum value of the given field.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetInstance(Locale) GetInstance(Locale)

Constructs a new instance of the Calendar subclass appropriate for the given Locale and default TimeZone, set to the current date and time.

GetInstance(TimeZone) GetInstance(TimeZone)

Constructs a new instance of the Calendar subclass appropriate for the default Locale and given TimeZone, set to the current date and time.

GetInstance(TimeZone, Locale) GetInstance(TimeZone, Locale)

Constructs a new instance of the Calendar subclass appropriate for the given Locale and given TimeZone, set to the current date and time.

GetLeastMaximum(CalendarField) GetLeastMaximum(CalendarField)

Returns the smallest maximum value of the given field.

GetMaximum(CalendarField) GetMaximum(CalendarField)

Returns the greatest maximum value of the given field.

GetMinimum(CalendarField) GetMinimum(CalendarField)

Returns the smallest minimum value of the given field. this returns the smallest value that get can return for the given field.

InternalGet(Int32) InternalGet(Int32)

Returns the value of the given field without recomputing.

IsSet(CalendarField) IsSet(CalendarField)

Tests whether the given field is set.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
Roll(CalendarField, Boolean) Roll(CalendarField, Boolean)

Increment or decrement the given field and wrap the value of the field when it goes beyond the maximum or minimum value for the current date.

Roll(CalendarField, Int32) Roll(CalendarField, Int32)

Adds the given amount to the given field and wraps the value of the field when it goes beyond the maximum or minimum value for the current date.

Set(CalendarField, Int32) Set(CalendarField, Int32)

Sets the given field to the given value.

Set(Int32, Int32, Int32) Set(Int32, Int32, Int32)

Sets the year, month, and day of the month fields.

Set(Int32, Int32, Int32, Int32, Int32) Set(Int32, Int32, Int32, Int32, Int32)

Sets the year, month, day of the month, hour of day, and minute fields.

Set(Int32, Int32, Int32, Int32, Int32, Int32) Set(Int32, Int32, Int32, Int32, Int32, Int32)

Sets the year, month, day of the month, hour of day, minute, and second fields.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetWeekDate(Int32, Int32, Int32) SetWeekDate(Int32, Int32, Int32)
ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

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

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to