The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Calendar class
Manipulates the representation of a date and time within a given calendar and clock.
Syntax
var calendar = new Windows.Globalization.Calendar(iIterable(String); var calendar = new Windows.Globalization.Calendar(iIterable(String); var calendar = new Windows.Globalization.Calendar();
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- ActivatableAttribute(Windows.Globalization.ICalendarFactory, NTDDI_WIN8)
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
Members
The Calendar class has these types of members:
Constructors
The Calendar class has these constructors.
| Constructor | Description |
|---|---|
| Calendar() | Creates a Calendar object and initializes it to the current date and time. |
| Calendar(IIterable(String)) | Creates a Calendar object that is initialized with a language list. |
| Calendar(IIterable(String), String, String) | Creates a Calendar object that is initialized with a language list, calendar, and clock. |
Methods
The Calendar class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| AddDays | Increments or decrements the day. |
| AddEras | Increments or decrements the era. |
| AddHours | Increments or decrements the hour. |
| AddMinutes | Increments or decrements the minute. |
| AddMonths | Increments or decrements the month. |
| AddNanoseconds | Increments or decrements the nanosecond. |
| AddPeriods | Increments or decrements the period. |
| AddSeconds | Increments or decrements the second. |
| AddWeeks | Increments or decrements the day by the specified number of weeks. |
| AddYears | Increments or decrements the year. |
| ChangeCalendarSystem | Sets a new calendar system to be used by this Calendar object. |
| ChangeClock | Sets a new clock to be used by this Calendar object. |
| Clone | Creates a copy of the Calendar object. |
| Compare | 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 | 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 | Copies the values from another Calendar object into this Calendar. |
| DayAsPaddedString | Returns a string representation of the day, optionally zero-padded. |
| DayAsString | Returns a string that contains the numeric representation of the day. |
| DayOfWeekAsSoloString() | Returns a string representation of the day of the week suitable for stand-alone display. |
| DayOfWeekAsSoloString(Int32) | Returns a string representation of the day of the week suitable for stand-alone display. |
| DayOfWeekAsString() | Returns a string representation of the day of the week suitable for inclusion with other date components. |
| DayOfWeekAsString(Int32) | Returns a string representation of the day of the week suitable for inclusion with other date components. |
| EraAsString() | Returns a string representation of the era. |
| EraAsString(Int32) | Returns a string representation of the era. The string chosen is closest in length to the ideal length. |
| GetCalendarSystem | Gets the calendar system that is used by this Calendar object. |
| GetClock | Gets the clock that is used by this Calendar object. |
| GetDateTime | Builds a date and time, given the components of this Calendar object. |
| HourAsPaddedString | Returns a string representation of the hour, optionally zero-padded. |
| HourAsString | Returns a string that contains the numeric representation of the hour. |
| MinuteAsPaddedString | Returns a string representation of the minute, optionally zero-padded. |
| MinuteAsString | Returns a string that contains the numeric representation of the minute. |
| MonthAsNumericString | Returns a string that contains the numeric representation of the month. |
| MonthAsPaddedNumericString | Returns a string representation of the month, optionally zero-padded. |
| MonthAsSoloString() | Returns a string representation of the month suitable for stand-alone display. |
| MonthAsSoloString(Int32) | Returns a string representation of the month suitable for stand-alone display. |
| MonthAsString() | Returns a string representation of the month suitable for inclusion with other date components. |
| MonthAsString(Int32) | Returns a string representation of the month suitable for inclusion with other date components. |
| NanosecondAsPaddedString | Returns a string representation of the nanosecond, optionally zero-padded. |
| NanosecondAsString | Returns a string that contains the numeric representation of the nanosecond. |
| PeriodAsString() | Returns a string representation of the day period, such as AM or PM, that uses the most common abbreviation available. |
| PeriodAsString(Int32) | Returns a string representation of the day period, such as AM or PM. |
| SecondAsPaddedString | Returns a string representation of the second, optionally zero-padded. |
| SecondAsString | Returns a string that contains the numeric representation of the second. |
| SetDateTime | Sets all the date and time fields to the date and time represented by the DateTime parameter. |
| SetToMax | Sets the components of this Calendar object to the latest date and time that are supported. |
| SetToMin | Sets the components of this Calendar object to the earliest date and time that are supported. |
| SetToNow | Sets the components of this Calendar object to the current date and time. |
| YearAsPaddedString | Returns a string representation of the year, optionally zero-padded. |
| YearAsString | Returns a string representation of the year without any initial zero padding. |
| YearAsTruncatedString | Returns a string representation of the year, optionally truncated. |
Properties
The Calendar class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read/write | Gets or sets the day. | |
| Read-only | Gets the day of the week. | |
| Read/write | Gets or sets the era. | |
| Read-only | Gets the first Day of the current Month. | |
| Read-only | Gets the first Era available in the calendar. | |
| Read-only | Gets the first Hour of the current Period. | |
| Read-only | Gets the first Minute of the current Hour. | |
| Read-only | Gets the first Month of the current Year. | |
| Read-only | Gets the first Period of the current Day. | |
| Read-only | Gets the first Second of the current Minute. | |
| Read-only | Gets the first Year of the current Era. | |
| Read/write | Gets or sets the hour. | |
| Read-only | Gets a Boolean indicating if Daylight Saving Time is in effect for the date of this Calendar object. | |
| Read-only | Gets the priority list of language identifiers that is used when formatting components as strings. | |
| Read-only | Gets the last Day of the current Month. | |
| Read-only | Gets the last Era available in the calendar. | |
| Read-only | Gets the last Hour of the current Period. | |
| Read-only | Gets the last Minute of the current Hour. | |
| Read-only | Gets the last Month of the current Year. | |
| Read-only | Gets the last Period of the current Day. | |
| Read-only | Gets the last Second of the current Minute. | |
| Read-only | Gets the last Year of the current Era. | |
| Read/write | Gets or sets the minute. | |
| Read/write | Gets or sets the month. | |
| Read/write | Gets or sets the nanosecond. | |
| Read-only | Gets the number of days in the current month of this Calendar object. | |
| Read-only | Gets the number of eras in this Calendar object. | |
| Read-only | Gets the number of hours in the current day period of this Calendar object. | |
| Read-only | Gets the number of Minutes in the current Hour. | |
| Read-only | Gets the number of months in the current year of this Calendar object. | |
| Read-only | Gets the number of periods in the current day of this Calendar object. | |
| Read-only | Gets the number of Seconds in the current Minute. | |
| Read-only | Gets the number of years in the current era of this Calendar object. | |
| Read/write | Gets or sets the numbering system that is used when formatting components as strings. | |
| Read/write | Gets or sets the period of the current day. | |
| Read-only | Gets the language that was most recently used to perform calendar formatting or operations. | |
| Read/write | Gets or sets the second. | |
| Read/write | Gets or sets the year. |
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.
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps, desktop apps] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps, desktop apps] |
|
Namespace |
|
|
Metadata |
|
Build date: 12/4/2012