Struct Date
Data structure that represents a date (year, month, day).
Implements
Inherited Members
Namespace: Unity.AppUI.Core
Assembly: Unity.AppUI.dll
Syntax
[Serializable]
public struct Date : IEquatable<Date>
Constructors
Date(DateTime)
Declaration
public Date(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | The DateTime to construct from. |
Date(int, int, int)
Constructs a Date from a year, month and day.
Declaration
public Date(int year, int month, int day)
Parameters
Type | Name | Description |
---|---|---|
int | year | The year. |
int | month | The month. |
int | day | The day |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the year, month or day is out of range. |
ArgumentOutOfRangeException | Thrown if the day is out of range for the given year and month. |
Properties
day
The date day.
Declaration
public int day { get; }
Property Value
Type | Description |
---|---|
int |
month
The date month.
Declaration
public int month { get; }
Property Value
Type | Description |
---|---|
int |
now
The current date.
Declaration
public static Date now { get; }
Property Value
Type | Description |
---|---|
Date |
year
The date year.
Declaration
public int year { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | Whether the specified object is equal to the current object. |
Overrides
Equals(Date)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(Date other)
Parameters
Type | Name | Description |
---|---|---|
Date | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | Whether the specified object is equal to the current object. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
ToString()
Returns a string that represents the current Date.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current Date. |
Overrides
Operators
operator ==(Date, Date)
Determines whether two Dates are equal.
Declaration
public static bool operator ==(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool | Whether the two Dates are equal. |
operator >(Date, Date)
Declaration
public static bool operator >(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool |
operator >=(Date, Date)
Declaration
public static bool operator >=(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool | Whether the left Date is greater than or equal to the right Date. |
implicit operator DateTime(Date)
Declaration
public static implicit operator DateTime(Date date)
Parameters
Type | Name | Description |
---|---|---|
Date | date | The Date to convert. |
Returns
Type | Description |
---|---|
DateTime | The converted DateTime. |
operator !=(Date, Date)
Determines whether two Dates are not equal.
Declaration
public static bool operator !=(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool | Whether the two Dates are not equal. |
operator <(Date, Date)
Declaration
public static bool operator <(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool |
operator <=(Date, Date)
Declaration
public static bool operator <=(Date left, Date right)
Parameters
Type | Name | Description |
---|---|---|
Date | left | The first Date to compare. |
Date | right | The second Date to compare. |
Returns
Type | Description |
---|---|
bool | Whether the left Date is less than or equal to the right Date. |