Struct Date
Represents date.
Inherited Members
Namespace: Syncfusion.Windows.Shared
Assembly: Syncfusion.Shared.Wpf.dll
Syntax
public struct Date : IEquatable<Date>, IComparable<Date>
Constructors
Date(DateTime, Calendar)
Initializes a new instance of the Date struct.
Declaration
public Date(DateTime date, Calendar calendar)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | The current date. |
System.Globalization.Calendar | calendar | The calendar. |
Date(Int32, Int32, Int32)
Initializes a new instance of the Date structure.
Declaration
public Date(int year, int month, int day)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | year | Year component of date. |
System.Int32 | month | Month component of date. |
System.Int32 | day | Day component of date. |
Properties
Day
Gets or sets the day component.
Declaration
public int Day { get; set; }
Property Value
Type |
---|
System.Int32 |
Month
Gets or sets the month component.
Declaration
public int Month { get; set; }
Property Value
Type |
---|
System.Int32 |
Year
Gets or sets the year component.
Declaration
public int Year { get; set; }
Property Value
Type |
---|
System.Int32 |
Methods
AddMonthToDate(Int32)
Adds specified number of months to the date.
Declaration
public Date AddMonthToDate(int month)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | month | Number of months. Can be negative or positive. |
Returns
Type | Description |
---|---|
Date | The computed date. |
CompareTo(Date)
Compares current date with other date.
Declaration
public int CompareTo(Date other)
Parameters
Type | Name | Description |
---|---|---|
Date | other | The date to compare the current date with. |
Returns
Type | Description |
---|---|
System.Int32 | -1 if the current date is less than given date; 1 if the current date is more than given date; otherwise, 0. |
Equals(Date)
Gets a value indicating whether the current date is equal to other date.
Declaration
public bool Equals(Date other)
Parameters
Type | Name | Description |
---|---|---|
Date | other | The date to compare the current date to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the current date is equal to the given date; otherwise, false. |
Equals(Object)
Returns a value indicating whether this instance is equal to a specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to be compared. |
Returns
Type | Description |
---|---|
System.Boolean | True if obj and this instance represent the same date; otherwise, false. |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash code of this instance. |
Overrides
ToDateTime(Calendar)
Toes the date time.
Declaration
public DateTime ToDateTime(Calendar calendar)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.Calendar | calendar | The calendar control. |
Returns
Type | Description |
---|---|
System.DateTime | Return the DateTime |
ToString()
Converts the value of the current Date object to its equivalent string representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Date string representation. |
Overrides
Operators
Equality(Date, Date)
Determines whether two specified instances of Date are equal.
Declaration
public static bool operator ==(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a and b represent the same date; otherwise, false. |
GreaterThan(Date, Date)
Declaration
public static bool operator>(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a is greater than b; otherwise, false. |
GreaterThanOrEqual(Date, Date)
Declaration
public static bool operator >=(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a is less than b; otherwise, false. |
Inequality(Date, Date)
Determines whether two specified instances of Date are not equal.
Declaration
public static bool operator !=(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a and b do not represent the same date; otherwise, false. |
LessThan(Date, Date)
Declaration
public static bool operator <(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a is less than b; otherwise, false. |
LessThanOrEqual(Date, Date)
Declaration
public static bool operator <=(Date a, Date b)
Parameters
Type | Name | Description |
---|---|---|
Date | a | First operand of comparison. |
Date | b | Second operand of comparison. |
Returns
Type | Description |
---|---|
System.Boolean | True if a is less than b; otherwise, false. |