docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct Date

    Data structure that represents a date (year, month, day).

    Implements
    IEquatable<Date>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.Core
    Assembly: Unity.AppUI.dll
    Syntax
    [Serializable]
    public struct Date : IEquatable<Date>

    Constructors

    Date(DateTime)

    Constructs a Date from a 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
    ValueType.Equals(object)

    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
    ValueType.GetHashCode()

    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
    ValueType.ToString()

    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)

    Determines whether the left Date is greater than the right 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 the right Date.

    operator >=(Date, Date)

    Determines whether the left Date is greater than or equal to the right 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)

    Converts a Date to a DateTime.

    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)

    Determines whether the left Date is less than the right 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 the right Date.

    operator <=(Date, Date)

    Determines whether the left Date is less than or equal to the right 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.

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)