Calendar Calendar Calendar Calendar Class

Definition

Manipulates the representation of a date and time within a given calendar and clock.

public sealed class Calendarpublic sealed class CalendarPublic NotInheritable Class Calendarpublic sealed class Calendar
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.

Constructors

Calendar() Calendar() Calendar() Calendar()

Creates a Calendar object and initializes it to the current date and time.

public Calendar()public New()Public Sub New()public Calendar()
Attributes

Calendar(IIterable<String>) Calendar(IIterable<String>) Calendar(IIterable<String>) Calendar(IIterable<String>)

Creates a Calendar object that is initialized with a language list.

public Calendar(IIterable<String> languages)public New(IIterable<String> languages)Public Sub New(languages As IIterable<String>)public Calendar(IIterable<String> languages)
Parameters
languages

The list of language identifiers, in priority order, that represents the choice of languages. These are used for resolving patterns to strings. See Remarks.

Attributes

Calendar(IIterable<String>, String, String) Calendar(IIterable<String>, String, String) Calendar(IIterable<String>, String, String) Calendar(IIterable<String>, String, String)

Creates a Calendar object that is initialized with a language list, calendar, and clock.

public Calendar(IIterable<String> languages, String calendar, String clock)public New(IIterable<String> languages, String calendar, String clock)Public Sub New(languages As IIterable<String>, calendar As String, clock As String)public Calendar(IIterable<String> languages, String calendar, String clock)
Parameters
languages

The list of language identifiers, in priority order, representing the choice of languages. These are used for resolving patterns to strings. See Remarks.

calendar
System.String System.String System.String System.String

The calendar identifier to use.

clock
System.String System.String System.String System.String

The clock identifier to use.

Attributes

Calendar(IIterable<String>, String, String, String) Calendar(IIterable<String>, String, String, String) Calendar(IIterable<String>, String, String, String) Calendar(IIterable<String>, String, String, String)

Creates a Calendar object that is initialized with a language list, calendar, clock, and time zone.

public Calendar(IIterable<String> languages, String calendar, String clock, String timeZoneId)public New(IIterable<String> languages, String calendar, String clock, String timeZoneId)Public Sub New(languages As IIterable<String>, calendar As String, clock As String, timeZoneId As String)public Calendar(IIterable<String> languages, String calendar, String clock, String timeZoneId)
Parameters
languages

The list of language identifiers, in priority order, representing the choice of languages. These are used for resolving patterns to strings. See Remarks.

calendar
System.String System.String System.String System.String

The calendar identifier to use.

clock
System.String System.String System.String System.String

The clock identifier to use.

timeZoneId
System.String System.String System.String System.String

An identifier from the IANA Time Zone Database which identifies the time zone that should be used (for example, "America/Los_Angeles" for Pacific Time).

Attributes

Properties

Day Day Day Day

Gets or sets the day.

public int Day { get; set; }public int Day { get; set; }Public ReadWrite Property Day As intpublic int Day { get; set; }
Value
int int int int

The day.

Attributes

DayOfWeek DayOfWeek DayOfWeek DayOfWeek

Gets the day of the week.

public DayOfWeek DayOfWeek { get; }public DayOfWeek DayOfWeek { get; }Public ReadOnly Property DayOfWeek As DayOfWeekpublic DayOfWeek DayOfWeek { get; }
Value
DayOfWeek DayOfWeek DayOfWeek DayOfWeek

The day of the week.

Attributes

Era Era Era Era

Gets or sets the era.

public int Era { get; set; }public int Era { get; set; }Public ReadWrite Property Era As intpublic int Era { get; set; }
Value
int int int int

The integer that represents the era.

Attributes

FirstDayInThisMonth FirstDayInThisMonth FirstDayInThisMonth FirstDayInThisMonth

Gets the first Day of the current Month.

public int FirstDayInThisMonth { get; }public int FirstDayInThisMonth { get; }Public ReadOnly Property FirstDayInThisMonth As intpublic int FirstDayInThisMonth { get; }
Value
int int int int

The first Day of the current Month.

Attributes

FirstEra FirstEra FirstEra FirstEra

Gets the first Era available in the calendar.

public int FirstEra { get; }public int FirstEra { get; }Public ReadOnly Property FirstEra As intpublic int FirstEra { get; }
Value
int int int int

The first Era in the calendar.

Attributes

FirstHourInThisPeriod FirstHourInThisPeriod FirstHourInThisPeriod FirstHourInThisPeriod

Gets the first Hour of the current Period.

public int FirstHourInThisPeriod { get; }public int FirstHourInThisPeriod { get; }Public ReadOnly Property FirstHourInThisPeriod As intpublic int FirstHourInThisPeriod { get; }
Value
int int int int

The first Hour of the current Period.

Attributes

FirstMinuteInThisHour FirstMinuteInThisHour FirstMinuteInThisHour FirstMinuteInThisHour

Gets the first Minute of the current Hour.

public int FirstMinuteInThisHour { get; }public int FirstMinuteInThisHour { get; }Public ReadOnly Property FirstMinuteInThisHour As intpublic int FirstMinuteInThisHour { get; }
Value
int int int int

The first Minute of the current Hour.

Attributes

FirstMonthInThisYear FirstMonthInThisYear FirstMonthInThisYear FirstMonthInThisYear

Gets the first Month of the current Year.

public int FirstMonthInThisYear { get; }public int FirstMonthInThisYear { get; }Public ReadOnly Property FirstMonthInThisYear As intpublic int FirstMonthInThisYear { get; }
Value
int int int int

The first Month of the current Year.

Attributes

FirstPeriodInThisDay FirstPeriodInThisDay FirstPeriodInThisDay FirstPeriodInThisDay

Gets the first Period of the current Day.

public int FirstPeriodInThisDay { get; }public int FirstPeriodInThisDay { get; }Public ReadOnly Property FirstPeriodInThisDay As intpublic int FirstPeriodInThisDay { get; }
Value
int int int int

The first Period of the current Day.

Attributes

FirstSecondInThisMinute FirstSecondInThisMinute FirstSecondInThisMinute FirstSecondInThisMinute

Gets the first Second of the current Minute.

public int FirstSecondInThisMinute { get; }public int FirstSecondInThisMinute { get; }Public ReadOnly Property FirstSecondInThisMinute As intpublic int FirstSecondInThisMinute { get; }
Value
int int int int

The first Second of the current Minute.

Attributes

FirstYearInThisEra FirstYearInThisEra FirstYearInThisEra FirstYearInThisEra

Gets the first Year of the current Era.

public int FirstYearInThisEra { get; }public int FirstYearInThisEra { get; }Public ReadOnly Property FirstYearInThisEra As intpublic int FirstYearInThisEra { get; }
Value
int int int int

The first Year of the current Era.

Attributes

Hour Hour Hour Hour

Gets or sets the hour.

public int Hour { get; set; }public int Hour { get; set; }Public ReadWrite Property Hour As intpublic int Hour { get; set; }
Value
int int int int

The hour.

Attributes

IsDaylightSavingTime IsDaylightSavingTime IsDaylightSavingTime IsDaylightSavingTime

Gets a Boolean indicating if Daylight Saving Time is in effect for the date of this Calendar object.

public bool IsDaylightSavingTime { get; }public bool IsDaylightSavingTime { get; }Public ReadOnly Property IsDaylightSavingTime As boolpublic bool IsDaylightSavingTime { get; }
Value
bool bool bool bool

True if Daylight Saving Time is in effect for the date; otherwise, False.

Attributes

Languages Languages Languages Languages

Gets the priority list of language identifiers that is used when formatting components as strings.

public IVectorView<string> Languages { get; }public IVectorView<string> Languages { get; }Public ReadOnly Property Languages As IVectorView<string>public IVectorView<string> Languages { get; }
Value

The list of language identifiers.

Starting in : Language tags can support Unicode extensions. See the Remarks for the @Windows.Globalization.Calendar.#ctor(Windows.Foundation.Collections.IIterable{System.String})?text=Calendar(IIterable(String)) constructor.

Attributes

LastDayInThisMonth LastDayInThisMonth LastDayInThisMonth LastDayInThisMonth

Gets the last Day of the current Month.

public int LastDayInThisMonth { get; }public int LastDayInThisMonth { get; }Public ReadOnly Property LastDayInThisMonth As intpublic int LastDayInThisMonth { get; }
Value
int int int int

The last Day of the current Month.

Attributes

LastEra LastEra LastEra LastEra

Gets the last Era available in the calendar.

public int LastEra { get; }public int LastEra { get; }Public ReadOnly Property LastEra As intpublic int LastEra { get; }
Value
int int int int

The last Era in the calendar.

Attributes

LastHourInThisPeriod LastHourInThisPeriod LastHourInThisPeriod LastHourInThisPeriod

Gets the last Hour of the current Period.

public int LastHourInThisPeriod { get; }public int LastHourInThisPeriod { get; }Public ReadOnly Property LastHourInThisPeriod As intpublic int LastHourInThisPeriod { get; }
Value
int int int int

The last Hour of the current Period.

Attributes

LastMinuteInThisHour LastMinuteInThisHour LastMinuteInThisHour LastMinuteInThisHour

Gets the last Minute of the current Hour.

public int LastMinuteInThisHour { get; }public int LastMinuteInThisHour { get; }Public ReadOnly Property LastMinuteInThisHour As intpublic int LastMinuteInThisHour { get; }
Value
int int int int

The last Minute of the current Hour.

Attributes

LastMonthInThisYear LastMonthInThisYear LastMonthInThisYear LastMonthInThisYear

Gets the last Month of the current Year.

public int LastMonthInThisYear { get; }public int LastMonthInThisYear { get; }Public ReadOnly Property LastMonthInThisYear As intpublic int LastMonthInThisYear { get; }
Value
int int int int

The last Month of the current Year.

Attributes

LastPeriodInThisDay LastPeriodInThisDay LastPeriodInThisDay LastPeriodInThisDay

Gets the last Period of the current Day.

public int LastPeriodInThisDay { get; }public int LastPeriodInThisDay { get; }Public ReadOnly Property LastPeriodInThisDay As intpublic int LastPeriodInThisDay { get; }
Value
int int int int

The last Period of the current Day.

Attributes

LastSecondInThisMinute LastSecondInThisMinute LastSecondInThisMinute LastSecondInThisMinute

Gets the last Second of the current Minute.

public int LastSecondInThisMinute { get; }public int LastSecondInThisMinute { get; }Public ReadOnly Property LastSecondInThisMinute As intpublic int LastSecondInThisMinute { get; }
Value
int int int int

The last Second of the current Minute.

Attributes

LastYearInThisEra LastYearInThisEra LastYearInThisEra LastYearInThisEra

Gets the last Year of the current Era.

public int LastYearInThisEra { get; }public int LastYearInThisEra { get; }Public ReadOnly Property LastYearInThisEra As intpublic int LastYearInThisEra { get; }
Value
int int int int

The last Year of the current Era.

Attributes

Minute Minute Minute Minute

Gets or sets the minute.

public int Minute { get; set; }public int Minute { get; set; }Public ReadWrite Property Minute As intpublic int Minute { get; set; }
Value
int int int int

The minute.

Attributes

Month Month Month Month

Gets or sets the month.

public int Month { get; set; }public int Month { get; set; }Public ReadWrite Property Month As intpublic int Month { get; set; }
Value
int int int int

The month.

Attributes

Nanosecond Nanosecond Nanosecond Nanosecond

Gets or sets the nanosecond.

public int Nanosecond { get; set; }public int Nanosecond { get; set; }Public ReadWrite Property Nanosecond As intpublic int Nanosecond { get; set; }
Value
int int int int

The nanosecond.

Attributes

NumberOfDaysInThisMonth NumberOfDaysInThisMonth NumberOfDaysInThisMonth NumberOfDaysInThisMonth

Gets the number of days in the current month of this Calendar object.

public int NumberOfDaysInThisMonth { get; }public int NumberOfDaysInThisMonth { get; }Public ReadOnly Property NumberOfDaysInThisMonth As intpublic int NumberOfDaysInThisMonth { get; }
Value
int int int int

The number of days in the current month, or – 1 if the number of days in the current month is unknown.

Attributes

NumberOfEras NumberOfEras NumberOfEras NumberOfEras

Gets the number of eras in this Calendar object.

public int NumberOfEras { get; }public int NumberOfEras { get; }Public ReadOnly Property NumberOfEras As intpublic int NumberOfEras { get; }
Value
int int int int

The number of eras in the Calendar, or – 1 if the number of eras in the Calendar is unknown.

Attributes

NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod

Gets the number of hours in the current day period of this Calendar object.

public int NumberOfHoursInThisPeriod { get; }public int NumberOfHoursInThisPeriod { get; }Public ReadOnly Property NumberOfHoursInThisPeriod As intpublic int NumberOfHoursInThisPeriod { get; }
Value
int int int int

The number of hours in the current day period, or – 1 if the number of hours in the current day period is unknown.

Attributes

NumberOfMinutesInThisHour NumberOfMinutesInThisHour NumberOfMinutesInThisHour NumberOfMinutesInThisHour

Gets the number of Minute s in the current Hour.

public int NumberOfMinutesInThisHour { get; }public int NumberOfMinutesInThisHour { get; }Public ReadOnly Property NumberOfMinutesInThisHour As intpublic int NumberOfMinutesInThisHour { get; }
Value
int int int int

The number of Minute s in the current Hour.

Attributes

NumberOfMonthsInThisYear NumberOfMonthsInThisYear NumberOfMonthsInThisYear NumberOfMonthsInThisYear

Gets the number of months in the current year of this Calendar object.

public int NumberOfMonthsInThisYear { get; }public int NumberOfMonthsInThisYear { get; }Public ReadOnly Property NumberOfMonthsInThisYear As intpublic int NumberOfMonthsInThisYear { get; }
Value
int int int int

The number of months in the current year, or – 1 if the number of months in the current year is unknown.

Attributes

NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay

Gets the number of periods in the current day of this Calendar object.

public int NumberOfPeriodsInThisDay { get; }public int NumberOfPeriodsInThisDay { get; }Public ReadOnly Property NumberOfPeriodsInThisDay As intpublic int NumberOfPeriodsInThisDay { get; }
Value
int int int int

The number of periods in the current day, or – 1 if the number of periods in the current day is unknown.

Attributes

NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute

Gets the number of Second s in the current Minute.

public int NumberOfSecondsInThisMinute { get; }public int NumberOfSecondsInThisMinute { get; }Public ReadOnly Property NumberOfSecondsInThisMinute As intpublic int NumberOfSecondsInThisMinute { get; }
Value
int int int int

The number of Second s in the current Minute.

Attributes

NumberOfYearsInThisEra NumberOfYearsInThisEra NumberOfYearsInThisEra NumberOfYearsInThisEra

Gets the number of years in the current era of this Calendar object.

public int NumberOfYearsInThisEra { get; }public int NumberOfYearsInThisEra { get; }Public ReadOnly Property NumberOfYearsInThisEra As intpublic int NumberOfYearsInThisEra { get; }
Value
int int int int

The number of years in the current era, or – 1 if there is no known bound to the number of years in the current era.

Attributes

NumeralSystem NumeralSystem NumeralSystem NumeralSystem

Gets or sets the numbering system that is used when formatting components as strings.

public string NumeralSystem { get; set; }public string NumeralSystem { get; set; }Public ReadWrite Property NumeralSystem As stringpublic string NumeralSystem { get; set; }
Value
string string string string

A string that indicates the numeral system of the calendar, such as "Latn" for the Latin numeral system (0123456789) or "Arab" for the Arabic-Indic numeral system (٠١٢٣٤٥٦٧٨٩). See the supported NumeralSystem values.

Attributes

Period Period Period Period

Gets or sets the period of the current day.

public int Period { get; set; }public int Period { get; set; }Public ReadWrite Property Period As intpublic int Period { get; set; }
Value
int int int int

A numeric representation of the current day period. With a 12-hour clock, for example, the first period of the day is 1, representing AM, and the second period is 2, representing PM.

Attributes

ResolvedLanguage ResolvedLanguage ResolvedLanguage ResolvedLanguage

Gets the language that was most recently used to perform calendar formatting or operations.

public string ResolvedLanguage { get; }public string ResolvedLanguage { get; }Public ReadOnly Property ResolvedLanguage As stringpublic string ResolvedLanguage { get; }
Value
string string string string

The language from the priority list of language identifiers that was most recently used to perform calendar formatting or operations.

Starting in : Language tags can support Unicode extensions. See the Remarks for the @Windows.Globalization.Calendar.#ctor(Windows.Foundation.Collections.IIterable{System.String})?text=Calendar(IIterable(String)) constructor.

Attributes

Second Second Second Second

Gets or sets the second.

public int Second { get; set; }public int Second { get; set; }Public ReadWrite Property Second As intpublic int Second { get; set; }
Value
int int int int

The second.

Attributes

Year Year Year Year

Gets or sets the year.

public int Year { get; set; }public int Year { get; set; }Public ReadWrite Property Year As intpublic int Year { get; set; }
Value
int int int int

The year.

Attributes

Methods

AddDays(Int32) AddDays(Int32) AddDays(Int32) AddDays(Int32)

Increments or decrements the day.

public void AddDays(Int32 days)public void AddDays(Int32 days)Public Function AddDays(days As Int32) As voidpublic void AddDays(Int32 days)
Parameters
days
System.Int32 System.Int32 System.Int32 System.Int32

The number of days by which to increment the day (if the value is positive) or decrement the day (if the value is negative).

Attributes

AddEras(Int32) AddEras(Int32) AddEras(Int32) AddEras(Int32)

Increments or decrements the era.

public void AddEras(Int32 eras)public void AddEras(Int32 eras)Public Function AddEras(eras As Int32) As voidpublic void AddEras(Int32 eras)
Parameters
eras
System.Int32 System.Int32 System.Int32 System.Int32

The number of eras by which to increment the era (if the value is positive) or decrement the era (if the value is negative).

Attributes

AddHours(Int32) AddHours(Int32) AddHours(Int32) AddHours(Int32)

Increments or decrements the hour.

public void AddHours(Int32 hours)public void AddHours(Int32 hours)Public Function AddHours(hours As Int32) As voidpublic void AddHours(Int32 hours)
Parameters
hours
System.Int32 System.Int32 System.Int32 System.Int32

The number of hours by which to increment the hour (if the value is positive) or decrement the hour (if the value is negative).

Attributes

AddMinutes(Int32) AddMinutes(Int32) AddMinutes(Int32) AddMinutes(Int32)

Increments or decrements the minute.

public void AddMinutes(Int32 minutes)public void AddMinutes(Int32 minutes)Public Function AddMinutes(minutes As Int32) As voidpublic void AddMinutes(Int32 minutes)
Parameters
minutes
System.Int32 System.Int32 System.Int32 System.Int32

The number of minutes by which to increment the minute (if the value is positive) or decrement the minute (if the value is negative).

Attributes

AddMonths(Int32) AddMonths(Int32) AddMonths(Int32) AddMonths(Int32)

Increments or decrements the month.

public void AddMonths(Int32 months)public void AddMonths(Int32 months)Public Function AddMonths(months As Int32) As voidpublic void AddMonths(Int32 months)
Parameters
months
System.Int32 System.Int32 System.Int32 System.Int32

The number of months by which to increment the month (if the value is positive) or decrement the month (if the value is negative).

Attributes

AddNanoseconds(Int32) AddNanoseconds(Int32) AddNanoseconds(Int32) AddNanoseconds(Int32)

Increments or decrements the nanosecond.

public void AddNanoseconds(Int32 nanoseconds)public void AddNanoseconds(Int32 nanoseconds)Public Function AddNanoseconds(nanoseconds As Int32) As voidpublic void AddNanoseconds(Int32 nanoseconds)
Parameters
nanoseconds
System.Int32 System.Int32 System.Int32 System.Int32

The number of nanoseconds by which to increment the nanosecond (if the value is positive) or decrement the nanosecond (if the value is negative).

Attributes

AddPeriods(Int32) AddPeriods(Int32) AddPeriods(Int32) AddPeriods(Int32)

Increments or decrements the period.

public void AddPeriods(Int32 periods)public void AddPeriods(Int32 periods)Public Function AddPeriods(periods As Int32) As voidpublic void AddPeriods(Int32 periods)
Parameters
periods
System.Int32 System.Int32 System.Int32 System.Int32

The number of periods by which to increment the period (if the value is positive) or decrement the period (if the value is negative).

Attributes

AddSeconds(Int32) AddSeconds(Int32) AddSeconds(Int32) AddSeconds(Int32)

Increments or decrements the second.

public void AddSeconds(Int32 seconds)public void AddSeconds(Int32 seconds)Public Function AddSeconds(seconds As Int32) As voidpublic void AddSeconds(Int32 seconds)
Parameters
seconds
System.Int32 System.Int32 System.Int32 System.Int32

The number of seconds by which to increment the second (if the value is positive) or decrement the second (if the value is negative).

Attributes

AddWeeks(Int32) AddWeeks(Int32) AddWeeks(Int32) AddWeeks(Int32)

Increments or decrements the day by the specified number of weeks.

public void AddWeeks(Int32 weeks)public void AddWeeks(Int32 weeks)Public Function AddWeeks(weeks As Int32) As voidpublic void AddWeeks(Int32 weeks)
Parameters
weeks
System.Int32 System.Int32 System.Int32 System.Int32

The number of weeks by which to increment the day (if the value is positive) or decrement the day (if the value is negative).

Attributes

AddYears(Int32) AddYears(Int32) AddYears(Int32) AddYears(Int32)

Increments or decrements the year.

public void AddYears(Int32 years)public void AddYears(Int32 years)Public Function AddYears(years As Int32) As voidpublic void AddYears(Int32 years)
Parameters
years
System.Int32 System.Int32 System.Int32 System.Int32

The number of years by which to increment the year (if the value is positive) or decrement the year (if the value is negative).

Attributes

ChangeCalendarSystem(String) ChangeCalendarSystem(String) ChangeCalendarSystem(String) ChangeCalendarSystem(String)

Sets a new calendar system to be used by this Calendar object.

public void ChangeCalendarSystem(String value)public void ChangeCalendarSystem(String value)Public Function ChangeCalendarSystem(value As String) As voidpublic void ChangeCalendarSystem(String value)
Parameters
value
System.String System.String System.String System.String

The calendar identifier to use.

Attributes

ChangeClock(String) ChangeClock(String) ChangeClock(String) ChangeClock(String)

Sets a new clock to be used by this Calendar object.

public void ChangeClock(String value)public void ChangeClock(String value)Public Function ChangeClock(value As String) As voidpublic void ChangeClock(String value)
Parameters
value
System.String System.String System.String System.String

The clock identifier to use.

Attributes

ChangeTimeZone(String) ChangeTimeZone(String) ChangeTimeZone(String) ChangeTimeZone(String)

Sets a new time zone to be used by this Calendar object.

public void ChangeTimeZone(String timeZoneId)public void ChangeTimeZone(String timeZoneId)Public Function ChangeTimeZone(timeZoneId As String) As voidpublic void ChangeTimeZone(String timeZoneId)
Parameters
timeZoneId
System.String System.String System.String System.String

An identifier from the IANA Time Zone Database which identifies the time zone that should be used (for example, "America/Los_Angeles" for Pacific Time).

Attributes

Remarks

The values of other properties of this Calendar object may change as a result.

Clone() Clone() Clone() Clone()

Creates a copy of the Calendar object.

public Calendar Clone()public Calendar Clone()Public Function Clone() As Calendarpublic Calendar Clone()
Returns
Attributes

Compare(Calendar) Compare(Calendar) Compare(Calendar) Compare(Calendar)

Compares this calendar to another Calendar object and indicates whether the date and time of one is earlier, equal to, or later than that of the other.

public int Compare(Calendar other)public int Compare(Calendar other)Public Function Compare(other As Calendar) As intpublic int Compare(Calendar other)
Parameters
other
Calendar Calendar Calendar Calendar

The Calendar object to compare to the current calendar.

Returns
int int int int

One of the following values:

Return valueDescription
Less than zeroThe date and time of this calendar is earlier than that of other.
ZeroThe date and times are equal.
Greater than zeroThe date and time of this calendar is later than that of other.
Attributes

CompareDateTime(DateTime) CompareDateTime(DateTime) CompareDateTime(DateTime) CompareDateTime(DateTime)

Compares this calendar to a DateTime object and indicates whether the date and time of one is earlier, equal to, or later than that of the other.

public int CompareDateTime(DateTime other)public int CompareDateTime(DateTime other)Public Function CompareDateTime(other As DateTime) As intpublic int CompareDateTime(DateTime other)
Parameters
other
DateTime DateTime DateTime DateTime

The DateTime object to compare to the current calendar.

Returns
int int int int

One of the following values:

Return valueDescription
Less than zeroThe date and time of this calendar is earlier than that of other.
ZeroThe date and times are equal.
Greater than zeroThe date and time of this calendar is later than that of other.
Attributes

CopyTo(Calendar) CopyTo(Calendar) CopyTo(Calendar) CopyTo(Calendar)

Copies the values from another Calendar object into this Calendar.

public void CopyTo(Calendar other)public void CopyTo(Calendar other)Public Function CopyTo(other As Calendar) As voidpublic void CopyTo(Calendar other)
Parameters
other
Calendar Calendar Calendar Calendar

The Calendar object to be copied.

Attributes

DayAsPaddedString(Int32) DayAsPaddedString(Int32) DayAsPaddedString(Int32) DayAsPaddedString(Int32)

Returns a string representation of the day, optionally zero-padded.

public string DayAsPaddedString(Int32 minDigits)public string DayAsPaddedString(Int32 minDigits)Public Function DayAsPaddedString(minDigits As Int32) As stringpublic string DayAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the day does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the day 3, a parameter of 1 returns 3, and a parameter of 2 returns 03.

Returns
string string string string

A string representation of the day.

Attributes

DayAsString() DayAsString() DayAsString() DayAsString()

Returns a string that contains the numeric representation of the day.

public string DayAsString()public string DayAsString()Public Function DayAsString() As stringpublic string DayAsString()
Returns
string string string string

A string representation of the day.

Attributes

DayOfWeekAsSoloString() DayOfWeekAsSoloString() DayOfWeekAsSoloString() DayOfWeekAsSoloString()

Returns a string representation of the day of the week suitable for stand-alone display.

public string DayOfWeekAsSoloString()public string DayOfWeekAsSoloString()Public Function DayOfWeekAsSoloString() As stringpublic string DayOfWeekAsSoloString()
Returns
string string string string

A string representation of the day of the week, using the most common abbreviation available.

Attributes

DayOfWeekAsSoloString(Int32) DayOfWeekAsSoloString(Int32) DayOfWeekAsSoloString(Int32) DayOfWeekAsSoloString(Int32)

Returns a string representation of the day of the week suitable for stand-alone display.

public string DayOfWeekAsSoloString(Int32 idealLength)public string DayOfWeekAsSoloString(Int32 idealLength)Public Function DayOfWeekAsSoloString(idealLength As Int32) As stringpublic string DayOfWeekAsSoloString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer specifying the ideal length, in characters, for the returned string, or 0 specifying the most common abbreviation available.

Returns
string string string string

A string representation of the day of the week.

Attributes

DayOfWeekAsString() DayOfWeekAsString() DayOfWeekAsString() DayOfWeekAsString()

Returns a string representation of the day of the week suitable for inclusion with other date components.

public string DayOfWeekAsString()public string DayOfWeekAsString()Public Function DayOfWeekAsString() As stringpublic string DayOfWeekAsString()
Returns
string string string string

A string representation of the day of the week, using the most common abbreviation available.

Attributes

DayOfWeekAsString(Int32) DayOfWeekAsString(Int32) DayOfWeekAsString(Int32) DayOfWeekAsString(Int32)

Returns a string representation of the day of the week suitable for inclusion with other date components.

public string DayOfWeekAsString(Int32 idealLength)public string DayOfWeekAsString(Int32 idealLength)Public Function DayOfWeekAsString(idealLength As Int32) As stringpublic string DayOfWeekAsString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer specifying the ideal length, in characters, for the returned string, or 0 specifying the most common abbreviation available.

Returns
string string string string

A string representation of the day of the week.

Attributes

EraAsString() EraAsString() EraAsString() EraAsString()

Returns a string representation of the era.

public string EraAsString()public string EraAsString()Public Function EraAsString() As stringpublic string EraAsString()
Returns
string string string string

A string representation of the era, using the most common abbreviation available.

Attributes

EraAsString(Int32) EraAsString(Int32) EraAsString(Int32) EraAsString(Int32)

Returns a string representation of the era. The string chosen is closest in length to the ideal length.

public string EraAsString(Int32 idealLength)public string EraAsString(Int32 idealLength)Public Function EraAsString(idealLength As Int32) As stringpublic string EraAsString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer specifying the ideal length, in characters, for the returned string, or 0 specifying the most common abbreviation available.

Returns
string string string string

A string representation of the era.

Attributes

GetCalendarSystem() GetCalendarSystem() GetCalendarSystem() GetCalendarSystem()

Gets the calendar system that is used by this Calendar object.

public string GetCalendarSystem()public string GetCalendarSystem()Public Function GetCalendarSystem() As stringpublic string GetCalendarSystem()
Returns
string string string string

The identifier of the calendar system.

Attributes

GetClock() GetClock() GetClock() GetClock()

Gets the clock that is used by this Calendar object.

public string GetClock()public string GetClock()Public Function GetClock() As stringpublic string GetClock()
Returns
string string string string

The identifier of the clock.

Attributes

GetDateTime() GetDateTime() GetDateTime() GetDateTime()

Builds a date and time, given the components of this Calendar object.

public DateTime GetDateTime()public DateTimeOffset GetDateTime()Public Function GetDateTime() As DateTimeOffsetpublic DateTime GetDateTime()
Returns

The DateTime representing the date and time of this Calendar.

Attributes

GetTimeZone() GetTimeZone() GetTimeZone() GetTimeZone()

Gets the identifier that identifies the time zone that is used by this Calendar object.

public string GetTimeZone()public string GetTimeZone()Public Function GetTimeZone() As stringpublic string GetTimeZone()
Returns
string string string string

The identifier from the IANA Time Zone Database that identifies the time zone that is used by this Calendar object. (An example is "America/Los_Angeles" for Pacific Time.)

Attributes

HourAsPaddedString(Int32) HourAsPaddedString(Int32) HourAsPaddedString(Int32) HourAsPaddedString(Int32)

Returns a string representation of the hour, optionally zero-padded.

public string HourAsPaddedString(Int32 minDigits)public string HourAsPaddedString(Int32 minDigits)Public Function HourAsPaddedString(minDigits As Int32) As stringpublic string HourAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the hour does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the hour 3, a parameter of 1 returns 3, and a parameter of 2 returns 03.

Returns
string string string string

A string representation of the hour.

Attributes

HourAsString() HourAsString() HourAsString() HourAsString()

Returns a string that contains the numeric representation of the hour.

public string HourAsString()public string HourAsString()Public Function HourAsString() As stringpublic string HourAsString()
Returns
string string string string

A string representation of the hour.

Attributes

MinuteAsPaddedString(Int32) MinuteAsPaddedString(Int32) MinuteAsPaddedString(Int32) MinuteAsPaddedString(Int32)

Returns a string representation of the minute, optionally zero-padded.

public string MinuteAsPaddedString(Int32 minDigits)public string MinuteAsPaddedString(Int32 minDigits)Public Function MinuteAsPaddedString(minDigits As Int32) As stringpublic string MinuteAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the minute does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the minute 3, a parameter of 1 returns 3, and a parameter of 2 returns 03.

Returns
string string string string

A string representation of the minute.

Attributes

MinuteAsString() MinuteAsString() MinuteAsString() MinuteAsString()

Returns a string that contains the numeric representation of the minute.

public string MinuteAsString()public string MinuteAsString()Public Function MinuteAsString() As stringpublic string MinuteAsString()
Returns
string string string string

A string representation of the minute.

Attributes

MonthAsNumericString() MonthAsNumericString() MonthAsNumericString() MonthAsNumericString()

Returns a string that contains the numeric representation of the month.

public string MonthAsNumericString()public string MonthAsNumericString()Public Function MonthAsNumericString() As stringpublic string MonthAsNumericString()
Returns
string string string string

A string representation of the month.

Attributes

MonthAsPaddedNumericString(Int32) MonthAsPaddedNumericString(Int32) MonthAsPaddedNumericString(Int32) MonthAsPaddedNumericString(Int32)

Returns a string representation of the month, optionally zero-padded.

public string MonthAsPaddedNumericString(Int32 minDigits)public string MonthAsPaddedNumericString(Int32 minDigits)Public Function MonthAsPaddedNumericString(minDigits As Int32) As stringpublic string MonthAsPaddedNumericString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the month does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the month 3, a parameter of 1 returns 3, and a parameter of 2 returns 03.

Returns
string string string string

A string representation of the month.

Attributes

MonthAsSoloString() MonthAsSoloString() MonthAsSoloString() MonthAsSoloString()

Returns a string representation of the month suitable for stand-alone display.

public string MonthAsSoloString()public string MonthAsSoloString()Public Function MonthAsSoloString() As stringpublic string MonthAsSoloString()
Returns
string string string string

A string representation of the month, using the most common abbreviation available.

Attributes

MonthAsSoloString(Int32) MonthAsSoloString(Int32) MonthAsSoloString(Int32) MonthAsSoloString(Int32)

Returns a string representation of the month suitable for stand-alone display.

public string MonthAsSoloString(Int32 idealLength)public string MonthAsSoloString(Int32 idealLength)Public Function MonthAsSoloString(idealLength As Int32) As stringpublic string MonthAsSoloString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer specifying the ideal length, in characters, for the returned string, or 0 specifying the most common abbreviation available.

Returns
string string string string

A string representation of the month.

Attributes

MonthAsString() MonthAsString() MonthAsString() MonthAsString()

Returns a string representation of the month suitable for inclusion with other date components.

public string MonthAsString()public string MonthAsString()Public Function MonthAsString() As stringpublic string MonthAsString()
Returns
string string string string

A string representation of the month, using the most common abbreviation available.

Attributes

MonthAsString(Int32) MonthAsString(Int32) MonthAsString(Int32) MonthAsString(Int32)

Returns a string representation of the month suitable for inclusion with other date components.

public string MonthAsString(Int32 idealLength)public string MonthAsString(Int32 idealLength)Public Function MonthAsString(idealLength As Int32) As stringpublic string MonthAsString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer specifying the ideal length, in characters, for the returned string, or 0 specifying the most common abbreviation available.

Returns
string string string string

A string representation of the month.

Attributes

NanosecondAsPaddedString(Int32) NanosecondAsPaddedString(Int32) NanosecondAsPaddedString(Int32) NanosecondAsPaddedString(Int32)

Returns a string representation of the nanosecond, optionally zero-padded.

public string NanosecondAsPaddedString(Int32 minDigits)public string NanosecondAsPaddedString(Int32 minDigits)Public Function NanosecondAsPaddedString(minDigits As Int32) As stringpublic string NanosecondAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the nanosecond does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the nanosecond 42, a parameter of 1 or 2 returns 42, and a parameter of 3 returns 042.

Returns
string string string string

A string representation of the nanosecond.

Attributes

NanosecondAsString() NanosecondAsString() NanosecondAsString() NanosecondAsString()

Returns a string that contains the numeric representation of the nanosecond.

public string NanosecondAsString()public string NanosecondAsString()Public Function NanosecondAsString() As stringpublic string NanosecondAsString()
Returns
string string string string

A string representation of the nanosecond.

Attributes

PeriodAsString() PeriodAsString() PeriodAsString() PeriodAsString()

Returns a string representation of the day period, such as AM or PM, that uses the most common abbreviation available.

public string PeriodAsString()public string PeriodAsString()Public Function PeriodAsString() As stringpublic string PeriodAsString()
Returns
string string string string

A string representation of the day period.

Attributes

PeriodAsString(Int32) PeriodAsString(Int32) PeriodAsString(Int32) PeriodAsString(Int32)

Returns a string representation of the day period, such as AM or PM.

public string PeriodAsString(Int32 idealLength)public string PeriodAsString(Int32 idealLength)Public Function PeriodAsString(idealLength As Int32) As stringpublic string PeriodAsString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer that specifies the ideal length, in characters, for the returned string; or a zero that specifies the most common abbreviation available.

Returns
string string string string

A string representation for the day period.

Attributes

SecondAsPaddedString(Int32) SecondAsPaddedString(Int32) SecondAsPaddedString(Int32) SecondAsPaddedString(Int32)

Returns a string representation of the second, optionally zero-padded.

public string SecondAsPaddedString(Int32 minDigits)public string SecondAsPaddedString(Int32 minDigits)Public Function SecondAsPaddedString(minDigits As Int32) As stringpublic string SecondAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the second does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the second 3, a parameter of 1 returns 3, and a parameter of 2 returns 03.

Returns
string string string string

A string representation of the second.

Attributes

SecondAsString() SecondAsString() SecondAsString() SecondAsString()

Returns a string that contains the numeric representation of the second.

public string SecondAsString()public string SecondAsString()Public Function SecondAsString() As stringpublic string SecondAsString()
Returns
string string string string

A string representation of the second.

Attributes

SetDateTime(DateTime) SetDateTime(DateTime) SetDateTime(DateTime) SetDateTime(DateTime)

Sets all the date and time fields to the date and time represented by the DateTime parameter.

public void SetDateTime(DateTime value)public void SetDateTime(DateTime value)Public Function SetDateTime(value As DateTime) As voidpublic void SetDateTime(DateTime value)
Parameters
value
DateTime DateTime DateTime DateTime

The DateTime that is used to set all of the date and time fields.

Attributes

SetToMax() SetToMax() SetToMax() SetToMax()

Sets the components of this Calendar object to the latest date and time that are supported.

public void SetToMax()public void SetToMax()Public Function SetToMax() As voidpublic void SetToMax()
Attributes

SetToMin() SetToMin() SetToMin() SetToMin()

Sets the components of this Calendar object to the earliest date and time that are supported.

public void SetToMin()public void SetToMin()Public Function SetToMin() As voidpublic void SetToMin()
Attributes

SetToNow() SetToNow() SetToNow() SetToNow()

Sets the components of this Calendar object to the current date and time.

public void SetToNow()public void SetToNow()Public Function SetToNow() As voidpublic void SetToNow()
Attributes

TimeZoneAsString() TimeZoneAsString() TimeZoneAsString() TimeZoneAsString()

Returns the full time zone name applicable at the instant of time that this Calendar object represents.

public string TimeZoneAsString()public string TimeZoneAsString()Public Function TimeZoneAsString() As stringpublic string TimeZoneAsString()
Returns
string string string string

The full time zone name. This usually differs depending on whether the time zone is observing Daylight Saving Time or not. It also may differ due to historical changes. (An example is "America/Los_Angeles" for Pacific Time.)

Attributes

TimeZoneAsString(Int32) TimeZoneAsString(Int32) TimeZoneAsString(Int32) TimeZoneAsString(Int32)

Returns the abbreviated time zone name applicable at the instant of time that this Calendar object represents.

public string TimeZoneAsString(Int32 idealLength)public string TimeZoneAsString(Int32 idealLength)Public Function TimeZoneAsString(idealLength As Int32) As stringpublic string TimeZoneAsString(Int32 idealLength)
Parameters
idealLength
System.Int32 System.Int32 System.Int32 System.Int32

The desired length of the abbreviation to be returned. Use 0 to request the abbreviation in most common use.

Returns
string string string string

The time zone abbreviation that is closest in length to idealLength. If there is a tie, the shorter abbreviation is returned. If idealLength is 0, the abbreviation in most common use is returned. (An example is "America/Los_Angeles" for Pacific Time.)

Attributes

YearAsPaddedString(Int32) YearAsPaddedString(Int32) YearAsPaddedString(Int32) YearAsPaddedString(Int32)

Returns a string representation of the year, optionally zero-padded.

public string YearAsPaddedString(Int32 minDigits)public string YearAsPaddedString(Int32 minDigits)Public Function YearAsPaddedString(minDigits As Int32) As stringpublic string YearAsPaddedString(Int32 minDigits)
Parameters
minDigits
System.Int32 System.Int32 System.Int32 System.Int32

The minimum number of integer digits to be displayed. If the year does not have enough integer digits, it will be padded with zeros to the correct amount. For example, for the year 42, a parameter of 1 or 2 returns 42, and a parameter of 3 returns 042.

Returns
string string string string

A string representation of the year.

Attributes

YearAsString() YearAsString() YearAsString() YearAsString()

Returns a string representation of the year without any initial zero padding.

public string YearAsString()public string YearAsString()Public Function YearAsString() As stringpublic string YearAsString()
Returns
string string string string

A string representation of the year.

Attributes

YearAsTruncatedString(Int32) YearAsTruncatedString(Int32) YearAsTruncatedString(Int32) YearAsTruncatedString(Int32)

Returns a string representation of the year, optionally truncated.

public string YearAsTruncatedString(Int32 remainingDigits)public string YearAsTruncatedString(Int32 remainingDigits)Public Function YearAsTruncatedString(remainingDigits As Int32) As stringpublic string YearAsTruncatedString(Int32 remainingDigits)
Parameters
remainingDigits
System.Int32 System.Int32 System.Int32 System.Int32

A positive integer that represents the number of least significant digits that should be included. For example, for the year 1234, a parameter of 2 returns 34, and a parameter of 4 or larger returns 1234.

Returns
string string string string

A string representation of the year.

Attributes