Show / Hide Table of Contents

Class CalendarInfo

Provides globalized calendar operations.

Inheritance
System.Object
CalendarInfo
CultureCalendarInfo
GregorianCalendarInfo
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Toolkit.dll
Syntax
public abstract class CalendarInfo

Constructors

| Improve this Doc View Source

CalendarInfo()

Initializes a new instance of the CalendarInfo class.

Declaration
protected CalendarInfo()

Properties

| Improve this Doc View Source

DateFormatInfo

Gets the DateTimeFormatInfo to use for formatting.

Declaration
public virtual DateTimeFormatInfo DateFormatInfo { get; }
Property Value
Type Description
System.Globalization.DateTimeFormatInfo
| Improve this Doc View Source

DaysInWeek

Gets the number of days in a week.

Declaration
public virtual int DaysInWeek { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

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 Source

AddDays(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source