Class CalendarInfo
Provides globalized calendar operations.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Toolkit.dll
Syntax
public abstract class CalendarInfo
Constructors
| Improve this Doc View SourceCalendarInfo()
Initializes a new instance of the CalendarInfo class.
Declaration
protected CalendarInfo()
Properties
| Improve this Doc View SourceDateFormatInfo
Gets the DateTimeFormatInfo to use for formatting.
Declaration
public virtual DateTimeFormatInfo DateFormatInfo { get; }
Property Value
Type | Description |
---|---|
System.Globalization.DateTimeFormatInfo |
DaysInWeek
Gets the number of days in a week.
Declaration
public virtual int DaysInWeek { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FirstDayOfWeek
Gets the first day of the week.
Declaration
public virtual DayOfWeek FirstDayOfWeek { get; }
Property Value
Type | Description |
---|---|
System.DayOfWeek |
Methods
| Improve this Doc View SourceAddDays(DateTime, Int32)
Returns a DateTime that is the specified number of days away from the specified DateTime.
Declaration
public virtual DateTime? AddDays(DateTime day, int days)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime to which to add days. |
System.Int32 | days | The number of days to add. |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | The DateTime that results from adding the specified number of days to the specified DateTime. |
AddMonths(DateTime, Int32)
Returns a DateTime that is the specified number of months away from the specified DateTime.
Declaration
public virtual DateTime? AddMonths(DateTime day, int months)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime to which to add months. |
System.Int32 | months | The number of months to add. |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | The DateTime that results from adding the specified number of months to the specified DateTime. |
AddYears(DateTime, Int32)
Returns a DateTime that is the specified number of years away from the specified DateTime.
Declaration
public virtual DateTime? AddYears(DateTime day, int years)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime to which to add years. |
System.Int32 | years | The number of years to add. |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | The DateTime that results from adding the specified number of years to the specified DateTime. |
Compare(DateTime, DateTime)
Compares two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance.
Declaration
public virtual int Compare(DateTime first, DateTime second)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | first | The first DateTime. |
System.DateTime | second | The second DateTime. |
Returns
Type | Description |
---|---|
System.Int32 | Less than zero indicates that first is less than second, zero indicates that first equals second, and greater than zero indicated that second is greater than first. |
CompareDays(DateTime, DateTime)
Compares the days of two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance.
Declaration
public virtual int CompareDays(DateTime first, DateTime second)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | first | The first DateTime. |
System.DateTime | second | The second DateTime. |
Returns
Type | Description |
---|---|
System.Int32 | Less than zero indicates that first is less than second, zero indicates that first equals second, and greater than zero indicated that second is greater than first. |
DateToLongString(DateTime)
Convert a DateTime to a long format string.
Declaration
public virtual string DateToLongString(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.String | Long format string representation of the date. |
DateToString(DateTime)
Convert a DateTime to a string.
Declaration
public virtual string DateToString(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.String | String representation of the date. |
DayToString(DateTime)
Convert the day of a DateTime to a string.
Declaration
public virtual string DayToString(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.String | String representation of the day of a DateTime. |
DecadeToString(Int32, Int32)
Convert a decade range to a string.
Declaration
public virtual string DecadeToString(int decadeStart, int decadeEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | decadeStart | The start of the decade. |
System.Int32 | decadeEnd | The end of the decade. |
Returns
Type | Description |
---|---|
System.String | String representation of the decade range. |
GetAbbreviatedMonthName(Int32)
Get the abbreviated month name for a given month.
Declaration
public virtual string GetAbbreviatedMonthName(int monthIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | monthIndex | Index of the month. |
Returns
Type | Description |
---|---|
System.String | The abbreviated month name for a given month. |
GetDayOfWeek(DateTime)
Get the day of the week of a DateTime.
Declaration
public virtual DayOfWeek GetDayOfWeek(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.DayOfWeek | The day of the week of a DateTime. |
GetDecadeEnd(DateTime)
Get the end of the DateTime's decade.
Declaration
public virtual int GetDecadeEnd(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.Int32 | The end of the DateTime's decade. |
GetDecadeStart(DateTime)
Get the start of the DateTime's decade.
Declaration
public virtual int GetDecadeStart(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.Int32 | The start of the DateTime's decade. |
GetFirstDayInMonth(DateTime)
Get the first day in the month of a DateTime.
Declaration
public virtual DateTime GetFirstDayInMonth(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.DateTime | The first day in the month of a DateTime. |
GetFirstDayInYear(DateTime)
Get the first day in the year of a DateTime.
Declaration
public virtual DateTime GetFirstDayInYear(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.DateTime | The first day in the year of a DateTime. |
GetMonthDifference(DateTime, DateTime)
Get the number of months between two dates.
Declaration
public virtual int GetMonthDifference(DateTime first, DateTime second)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | first | The first date. |
System.DateTime | second | The second date. |
Returns
Type | Description |
---|---|
System.Int32 | The number of months between the two dates. |
GetShortestDayName(Int32)
Get the shortest day name for a given day of week.
Declaration
public virtual string GetShortestDayName(int dayOfWeekIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dayOfWeekIndex | Index of the day of week. |
Returns
Type | Description |
---|---|
System.String | The shortest day name for a given day of week. |
MonthAndYearToString(DateTime)
Convert the year and month of a DateTime to a string.
Declaration
public virtual string MonthAndYearToString(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.String | String representation of the year and month of a DateTime. |
YearToString(DateTime)
Convert the year of a DateTime to a string.
Declaration
public virtual string YearToString(DateTime day)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | day | The DateTime. |
Returns
Type | Description |
---|---|
System.String | String representation of the year of a DateTime. |