Calendar Calendar Calendar Calendar Calendar Class

Definition

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

public : sealed class Calendar : ICalendar, ITimeZoneOnCalendar
struct winrt::Windows::Globalization::Calendar : ICalendar, ITimeZoneOnCalendar
public sealed class Calendar : ICalendar, ITimeZoneOnCalendar
Public NotInheritable Class Calendar Implements ICalendar, ITimeZoneOnCalendar
var calendar = new 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() Calendar()

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

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

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

Calendar(IIterable<String>, String, String) 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.

Calendar(IIterable<String>, String, String, String) 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.

Properties

Day Day Day Day Day

Gets or sets the day.

DayOfWeek DayOfWeek DayOfWeek DayOfWeek DayOfWeek

Gets the day of the week.

Era Era Era Era Era

Gets or sets the era.

FirstDayInThisMonth FirstDayInThisMonth FirstDayInThisMonth FirstDayInThisMonth FirstDayInThisMonth

Gets the first Day of the current Month.

FirstEra FirstEra FirstEra FirstEra FirstEra

Gets the first Era available in the calendar.

FirstHourInThisPeriod FirstHourInThisPeriod FirstHourInThisPeriod FirstHourInThisPeriod FirstHourInThisPeriod

Gets the first Hour of the current Period.

FirstMinuteInThisHour FirstMinuteInThisHour FirstMinuteInThisHour FirstMinuteInThisHour FirstMinuteInThisHour

Gets the first Minute of the current Hour.

FirstMonthInThisYear FirstMonthInThisYear FirstMonthInThisYear FirstMonthInThisYear FirstMonthInThisYear

Gets the first Month of the current Year.

FirstPeriodInThisDay FirstPeriodInThisDay FirstPeriodInThisDay FirstPeriodInThisDay FirstPeriodInThisDay

Gets the first Period of the current Day.

FirstSecondInThisMinute FirstSecondInThisMinute FirstSecondInThisMinute FirstSecondInThisMinute FirstSecondInThisMinute

Gets the first Second of the current Minute.

FirstYearInThisEra FirstYearInThisEra FirstYearInThisEra FirstYearInThisEra FirstYearInThisEra

Gets the first Year of the current Era.

Hour Hour Hour Hour Hour

Gets or sets the hour.

IsDaylightSavingTime IsDaylightSavingTime IsDaylightSavingTime IsDaylightSavingTime IsDaylightSavingTime

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

Languages Languages Languages Languages Languages

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

LastDayInThisMonth LastDayInThisMonth LastDayInThisMonth LastDayInThisMonth LastDayInThisMonth

Gets the last Day of the current Month.

LastEra LastEra LastEra LastEra LastEra

Gets the last Era available in the calendar.

LastHourInThisPeriod LastHourInThisPeriod LastHourInThisPeriod LastHourInThisPeriod LastHourInThisPeriod

Gets the last Hour of the current Period.

LastMinuteInThisHour LastMinuteInThisHour LastMinuteInThisHour LastMinuteInThisHour LastMinuteInThisHour

Gets the last Minute of the current Hour.

LastMonthInThisYear LastMonthInThisYear LastMonthInThisYear LastMonthInThisYear LastMonthInThisYear

Gets the last Month of the current Year.

LastPeriodInThisDay LastPeriodInThisDay LastPeriodInThisDay LastPeriodInThisDay LastPeriodInThisDay

Gets the last Period of the current Day.

LastSecondInThisMinute LastSecondInThisMinute LastSecondInThisMinute LastSecondInThisMinute LastSecondInThisMinute

Gets the last Second of the current Minute.

LastYearInThisEra LastYearInThisEra LastYearInThisEra LastYearInThisEra LastYearInThisEra

Gets the last Year of the current Era.

Minute Minute Minute Minute Minute

Gets or sets the minute.

Month Month Month Month Month

Gets or sets the month.

Nanosecond Nanosecond Nanosecond Nanosecond Nanosecond

Gets or sets the nanosecond.

NumberOfDaysInThisMonth NumberOfDaysInThisMonth NumberOfDaysInThisMonth NumberOfDaysInThisMonth NumberOfDaysInThisMonth

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

NumberOfEras NumberOfEras NumberOfEras NumberOfEras NumberOfEras

Gets the number of eras in this Calendar object.

NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod NumberOfHoursInThisPeriod

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

NumberOfMinutesInThisHour NumberOfMinutesInThisHour NumberOfMinutesInThisHour NumberOfMinutesInThisHour NumberOfMinutesInThisHour

Gets the number of Minute s in the current Hour.

NumberOfMonthsInThisYear NumberOfMonthsInThisYear NumberOfMonthsInThisYear NumberOfMonthsInThisYear NumberOfMonthsInThisYear

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

NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay NumberOfPeriodsInThisDay

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

NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute NumberOfSecondsInThisMinute

Gets the number of Second s in the current Minute.

NumberOfYearsInThisEra NumberOfYearsInThisEra NumberOfYearsInThisEra NumberOfYearsInThisEra NumberOfYearsInThisEra

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

NumeralSystem NumeralSystem NumeralSystem NumeralSystem NumeralSystem

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

Period Period Period Period Period

Gets or sets the period of the current day.

ResolvedLanguage ResolvedLanguage ResolvedLanguage ResolvedLanguage ResolvedLanguage

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

Second Second Second Second Second

Gets or sets the second.

Year Year Year Year Year

Gets or sets the year.

Methods

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

Increments or decrements the day.

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

Increments or decrements the era.

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

Increments or decrements the hour.

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

Increments or decrements the minute.

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

Increments or decrements the month.

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

Increments or decrements the nanosecond.

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

Increments or decrements the period.

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

Increments or decrements the second.

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

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

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

Increments or decrements the year.

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

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

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

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

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

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

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

Creates a copy of the Calendar object.

Compare(Calendar) 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.

CompareDateTime(DateTime) 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.

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

Copies the values from another Calendar object into this Calendar.

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

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

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

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

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

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

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

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

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

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

DayOfWeekAsString(Int32) 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.

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

Returns a string representation of the era.

EraAsString(Int32) 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.

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

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

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

Gets the clock that is used by this Calendar object.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SetDateTime(DateTime) 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.

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

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

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

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

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

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

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

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

TimeZoneAsString(Int32) 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.

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

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

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

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

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

Returns a string representation of the year, optionally truncated.

See Also