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

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

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

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

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

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

Returns the result of comparing this instance to another Date.

CompareTo ( Object other ) : int

Returns the result of comparing this instance to another Object.

DateTime ( int day, int month, int year, int hours, int minutes, decimal seconds, bool utc ) : System

Constructs a DateTime instance given all the date and time components and a flag indicating UTC time or not.

DateTime ( int day, int month, int year, int hours, int minutes, decimal seconds, int offset ) : System

Constructs a DateTime instance given all the date and time components plus a time zone offset.

DateTime ( int day, int month, int year, int hours, int minutes, int seconds ) : System

Constructs a DateTime instance given all the date and time components.

DateTime ( int day, int month, int year, int hours, int minutes, int seconds, bool utc ) : System

Constructs a DateTime instance given all the date and time components and a flag indicating UTC time or not.

DateTime ( int day, int month, int year, int hours, int minutes, int seconds, int offset ) : System

Constructs a DateTime instance given all the date and time components plus a time zone offset.

Equals ( DateTime other ) : bool

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

Equals ( object other ) : bool

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

GetHashCode ( ) : int

Returns the hash value of the date for hash based data structures and algorithms.

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.

Normalize ( ) : DateTime

Uses the timezone information to create a UTC normalised DateTime from the current instance.

Parse ( String text ) : DateTime

Parses a DateTime instance from a character string in the ISO date format (as produced by ToString).

ToDate ( ) : Date

Creates a Date instance based in the date component values of the current instance.

ToString ( ) : string

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

ToTime ( ) : Time

Creates a Time instance based in the date component values of the current instance.

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

Метод Описание
DateTime ( DateValue dateValue, TimeValue timeValue, TimeZone timeZone ) : System

Constructs a DateTime instance from its date, time and time zone components.

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

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

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

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

Returns the result of comparing this instance to another Object.
If the argument is not a /// Date instance.
public CompareTo ( Object other ) : int
other Object The instance to compare with.
Результат int

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

Constructs a DateTime instance given all the date and time components and a flag indicating UTC time or not.
public DateTime ( int day, int month, int year, int hours, int minutes, decimal seconds, bool utc ) : 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).
hours int The number of hours (0-24).
minutes int The number of minutes (0-59).
seconds decimal The number of seconds (0-59).
utc bool Indicates UTC time zone.
Результат System

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

Constructs a DateTime instance given all the date and time components plus a time zone offset.
public DateTime ( int day, int month, int year, int hours, int minutes, decimal seconds, int offset ) : 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).
hours int The number of hours (0-24).
minutes int The number of minutes (0-59).
seconds decimal The number of seconds (0-59).
offset int The time zone offset.
Результат System

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

Constructs a DateTime instance given all the date and time components.
public DateTime ( int day, int month, int year, int hours, int minutes, int seconds ) : 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).
hours int The number of hours (0-24).
minutes int The number of minutes (0-59).
seconds int The number of seconds (0-59).
Результат System

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

Constructs a DateTime instance given all the date and time components and a flag indicating UTC time or not.
public DateTime ( int day, int month, int year, int hours, int minutes, int seconds, bool utc ) : 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).
hours int The number of hours (0-24).
minutes int The number of minutes (0-59).
seconds int The number of seconds (0-59).
utc bool Indicates UTC time zone.
Результат System

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

Constructs a DateTime instance given all the date and time components plus a time zone offset.
public DateTime ( int day, int month, int year, int hours, int minutes, int seconds, int offset ) : 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).
hours int The number of hours (0-24).
minutes int The number of minutes (0-59).
seconds int The number of seconds (0-59).
offset int The time zone offset.
Результат System

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

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

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

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

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

Returns the hash value of the date for hash based data structures and algorithms.
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

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

Uses the timezone information to create a UTC normalised DateTime from the current instance.
public Normalize ( ) : DateTime
Результат DateTime

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

Parses a DateTime instance from a character string in the ISO date format (as produced by ToString).
If the character string is not in the /// correct format.
public static Parse ( String text ) : DateTime
text String The text string to be parsed.
Результат DateTime

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

Creates a Date instance based in the date component values of the current instance.
public ToDate ( ) : Date
Результат Date

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

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

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

Creates a Time instance based in the date component values of the current instance.
public ToTime ( ) : Time
Результат Time

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

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

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

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

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