C# Класс HandCoded.Finance.DateValue

Наследование: IImmutableDate, IComparable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
MAX_VALUE DateValue
MIN_VALUE DateValue

Открытые методы

Метод Описание
CompareTo ( DateValue other ) : int

Returns the result of comparing this instance to another DateValue.

CompareTo ( object other ) : int

Returns the result of comparing this instance to another object.

DateValue ( int day, int month, int year ) : System

Constructs a DateValue instance given a day, month and year.

Equals ( DateValue other ) : bool

Determines if this DateValue instance and another instance hold the same date.

Equals ( object other ) : bool

Determines if this DateValue instance and another object hold the same date.

GetHashCode ( ) : int
IsLeapYear ( int year ) : bool

Determines if a year is a leap year.

MonthLength ( int month, bool leapYear ) : int

Returns the number of days in the given month in a leap or non-leap year.

MonthLength ( int month, int year ) : int

Returns the number of days in the given month for the specified year.

Plus ( Interval interval ) : DateValue

Creates a new DateValue based on the current instance and a given Interval.

PlusDays ( int days ) : DateValue

Creates a new DateValue based in the current instance and a given number of days adjustment.

PlusMonths ( int months ) : DateValue

Creates a new DateValue based on the current instance and a given number of months adjustment.

PlusWeeks ( int weeks ) : DateValue

Creates a new DateValue based on the current instance and a given number of weeks adjustment.

PlusYears ( int years ) : DateValue

Creates a new DateValue based on the current instance and a given number of years adjustment.

ToString ( ) : string

Converts the instance data members to a string representation that can be displayed for debugging purposes.

Приватные методы

Метод Описание
DateValue ( int date ) : System

Constructs a DateValue given a Julian day number.

MonthOffset ( int month, bool leapYear ) : int

Returns the offset from the start of the year in days of the given month in a leap or non-leap year.

This function is not exposed publically as it reveals the implementation.

YearOffset ( int year ) : int

Returns the day count offset of the given year.

Описание методов

CompareTo() публичный Метод

Returns the result of comparing this instance to another DateValue.
public CompareTo ( DateValue other ) : int
other DateValue The DateValue instance to compare with.
Результат int

CompareTo() публичный Метод

Returns the result of comparing this instance to another object.
public CompareTo ( object other ) : int
other object The instance to compare with.
Результат int

DateValue() публичный Метод

Constructs a DateValue instance given a day, month and year.
If the day, month or year /// values are outside the correct range.
public DateValue ( int day, int month, int year ) : System
day int The day of the month (1-31).
month int The month of the year (1-12).
year int The year (1900-2099).
Результат System

Equals() публичный Метод

Determines if this DateValue instance and another instance hold the same date.
public Equals ( DateValue other ) : bool
other DateValue The DateValue instance to compare with.
Результат bool

Equals() публичный Метод

Determines if this DateValue instance and another object hold the same date.
public Equals ( object other ) : bool
other object The instance to compare with.
Результат bool

GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int

IsLeapYear() публичный статический Метод

Determines if a year is a leap year.
public static IsLeapYear ( int year ) : bool
year int The year to test (1900-2099)
Результат bool

MonthLength() публичный статический Метод

Returns the number of days in the given month in a leap or non-leap year.
public static MonthLength ( int month, bool leapYear ) : int
month int The month number (1-12).
leapYear bool Flag to indicate a leap year.
Результат int

MonthLength() публичный статический Метод

Returns the number of days in the given month for the specified year.
public static MonthLength ( int month, int year ) : int
month int The month number (1-12).
year int The year (1900-2099).
Результат int

Plus() публичный Метод

Creates a new DateValue based on the current instance and a given Interval.
public Plus ( Interval interval ) : DateValue
interval Interval The time .
Результат DateValue

PlusDays() публичный Метод

Creates a new DateValue based in the current instance and a given number of days adjustment.
public PlusDays ( int days ) : DateValue
days int The number of days to adjust by.
Результат DateValue

PlusMonths() публичный Метод

Creates a new DateValue based on the current instance and a given number of months adjustment.
public PlusMonths ( int months ) : DateValue
months int The number of months to adjust by.
Результат DateValue

PlusWeeks() публичный Метод

Creates a new DateValue based on the current instance and a given number of weeks adjustment.
public PlusWeeks ( int weeks ) : DateValue
weeks int The number of weeks to adjust by.
Результат DateValue

PlusYears() публичный Метод

Creates a new DateValue based on the current instance and a given number of years adjustment.
public PlusYears ( int years ) : DateValue
years int The number of years to adjust by.
Результат DateValue

ToString() публичный Метод

Converts the instance data members to a string representation that can be displayed for debugging purposes.
public ToString ( ) : string
Результат string

Описание свойств

MAX_VALUE публичное статическое свойство

The latest possible date that can be correctly represented.
public static DateValue,HandCoded.Finance MAX_VALUE
Результат DateValue

MIN_VALUE публичное статическое свойство

The earliest possible date that can be correctly represented,
public static DateValue,HandCoded.Finance MIN_VALUE
Результат DateValue