Export (0) Print
Expand All
Information
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

Applies to Windows and Windows Phone

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(iIterable(String));
var calendar = new Windows.Globalization.Calendar();

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

Members

The Calendar class has these types of members:

Constructors

The Calendar class has these constructors.

ConstructorDescription
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.
Calendar(IIterable(String),String,String,String) Creates a Calendar object that is initialized with a language list, calendar, clock, and time zone.

 

Methods

The Calendar class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
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.
ChangeTimeZone Sets a new time zone 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.
GetTimeZone Gets the identifier that identifies the time zone that is used by 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.
TimeZoneAsString Returns the full time zone name applicable at the instant of time that this Calendar object represents.
TimeZoneAsString(Int32) Returns the abbreviated time zone name applicable at the instant of time that this Calendar object represents.
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.

PropertyAccess typeDescription

Day

Read/writeGets or sets the day.

DayOfWeek

Read-onlyGets the day of the week.

Era

Read/writeGets or sets the era.

FirstDayInThisMonth

Read-onlyGets the first Day of the current Month.

FirstEra

Read-onlyGets the first Era available in the calendar.

FirstHourInThisPeriod

Read-onlyGets the first Hour of the current Period.

FirstMinuteInThisHour

Read-onlyGets the first Minute of the current Hour.

FirstMonthInThisYear

Read-onlyGets the first Month of the current Year.

FirstPeriodInThisDay

Read-onlyGets the first Period of the current Day.

FirstSecondInThisMinute

Read-onlyGets the first Second of the current Minute.

FirstYearInThisEra

Read-onlyGets the first Year of the current Era.

Hour

Read/writeGets or sets the hour.

IsDaylightSavingTime

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

Languages

Read-onlyGets the priority list of language identifiers that is used when formatting components as strings.

LastDayInThisMonth

Read-onlyGets the last Day of the current Month.

LastEra

Read-onlyGets the last Era available in the calendar.

LastHourInThisPeriod

Read-onlyGets the last Hour of the current Period.

LastMinuteInThisHour

Read-onlyGets the last Minute of the current Hour.

LastMonthInThisYear

Read-onlyGets the last Month of the current Year.

LastPeriodInThisDay

Read-onlyGets the last Period of the current Day.

LastSecondInThisMinute

Read-onlyGets the last Second of the current Minute.

LastYearInThisEra

Read-onlyGets the last Year of the current Era.

Minute

Read/writeGets or sets the minute.

Month

Read/writeGets or sets the month.

Nanosecond

Read/writeGets or sets the nanosecond.

NumberOfDaysInThisMonth

Read-onlyGets the number of days in the current month of this Calendar object.

NumberOfEras

Read-onlyGets the number of eras in this Calendar object.

NumberOfHoursInThisPeriod

Read-onlyGets the number of hours in the current day period of this Calendar object.

NumberOfMinutesInThisHour

Read-onlyGets the number of Minutes in the current Hour.

NumberOfMonthsInThisYear

Read-onlyGets the number of months in the current year of this Calendar object.

NumberOfPeriodsInThisDay

Read-onlyGets the number of periods in the current day of this Calendar object.

NumberOfSecondsInThisMinute

Read-onlyGets the number of Seconds in the current Minute.

NumberOfYearsInThisEra

Read-onlyGets the number of years in the current era of this Calendar object.

NumeralSystem

Read/writeGets or sets the numbering system that is used when formatting components as strings.

Period

Read/writeGets or sets the period of the current day.

ResolvedLanguage

Read-onlyGets the language that was most recently used to perform calendar formatting or operations.

Second

Read/writeGets or sets the second.

Year

Read/writeGets 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]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Globalization
Windows::Globalization [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft