Date Structure

Represents a date with efficient operations.

Definition

Namespace: Austra.Library.Dates
Assembly: Austra.Library (in Austra.Library.dll) Version: 2.5.0+44e7797405725ef3cf24b3ff0eba94ce6c649601
C#
public readonly struct Date : IEquatable<Date>, 
	IComparable<Date>, IEqualityOperators<Date, Date, bool>, 
	IComparisonOperators<Date, Date, bool>, IAdditionOperators<Date, int, Date>, 
	ISubtractionOperators<Date, int, Date>, ISubtractionOperators<Date, Date, int>, 
	IIncrementOperators<Date>, IDecrementOperators<Date>
Inheritance
Object    ValueType    Date
Implements
IComparableDate, IEquatableDate, IAdditionOperatorsDate, Int32, Date, IComparisonOperatorsDate, Date, Boolean, IDecrementOperatorsDate, IEqualityOperatorsDate, Date, Boolean, IIncrementOperatorsDate, ISubtractionOperatorsDate, Int32, Date, ISubtractionOperatorsDate, Date, Int32

Constructors

Date(UInt32)Creates a Date from a day offset.
Date(Int32, Int32, Int32)Creates a Date instance given its three components.

Properties

DayGets the day component from the date.
DayOfWeekGets the day of week, being 0 the code for a Sunday.
MonthGets the month component from the date.
TodayGets the current date.
ToIntGets the number of days since Jan 1st, 1, as an signed integer.
YearGets the year component from the date.
ZeroGets the zero date.

Methods

AddMonths(Int32)Adds a number of months to this date.
AddMonths(Int32, Int32, Int32, Int32)Adds a number of months to a given date.
AddYearsAdds a number of years to this date.
CompareToCompares the current date with another.
DaysInMonthReturns the number of days in the month given by a year and month.
Deconstruct(Int32, Int32)Extracts the year and month in a single call.
Deconstruct(Int32, Int32, Int32)Extracts all components from a date in a single call.
Equals(Date)Compares this date to another date.
Equals(Object)Compares this date to another object for equality.
(Overrides ValueTypeEquals(Object))
FromYearCreates a Date instance for Jan 1st of the given year.
GetHashCodeReturns a hash code for this date.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsLeapChecks if the date belongs to a leap year.
IsLeapYearChecks if a given year is a leap year.
MaxGets the maximum of two dates.
MinGets the minimum of two dates.
RollEOMRolls this date up to the end of month.
RollIMMRolls this date up to the third Wednesday of the month.
ToStringGets a textual representation of this date.
(Overrides ValueTypeToString)
ToString(String, IFormatProvider)Gets a textual representation of this date.
TruncateDayChange the day of a date to the first day in the month.

Operators

Addition(Date, Int32)Adds a number of days to a date.
Decrement(Date)Decrements a date by a day.
Equality(Date, Date)Compares two dates for equality.
(Date to DateOnly)Converts a date into a standard date-only struct.
(Date to DateTime)Converts a date into a date and time.
(Date to UInt32)Converts a date to an unsigned integer.
(DateTime to Date)Converts a date and time into a date.
GreaterThan(Date, Date)Checks if the first date comes later the second.
GreaterThanOrEqual(Date, Date)Checks if the first date is equal or comes before the second.
Increment(Date)Increments a date by a day.
Inequality(Date, Date)Compares two dates for inequality.
LessThan(Date, Date)Checks if the first date comes before the second.
LessThanOrEqual(Date, Date)Checks if the first date is equal comes before the second.
Subtraction(Date, Date)Gets the number of days between two dates.
Subtraction(Date, Int32)Subtracts a number of days from a date.

Fields

TicksPerDayNumber of 100ns ticks per day.

See Also