C# Class HandCoded.Finance.DateTime

Inheritance: TemporalDate, IImmutableDate, IImmutableTime, IComparable
Mostrar archivo Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Public Properties

Property Type Description
MAX_VALUE DateTime
MIN_VALUE DateTime

Public Methods

Method Description
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.

Private Methods

Method Description
DateTime ( DateValue dateValue, TimeValue timeValue, TimeZone timeZone ) : System

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

Method Details

CompareTo() public method

Returns the result of comparing this instance to another Date.
public CompareTo ( DateTime other ) : int
other DateTime The Date instance to compare with.
return int

CompareTo() public method

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.
return int

DateTime() public method

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.
return System

DateTime() public method

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.
return System

DateTime() public method

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).
return System

DateTime() public method

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.
return System

DateTime() public method

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.
return System

Equals() public method

Determines if this Date instance and another hold the same date.
public Equals ( DateTime other ) : bool
other DateTime The Date instance to compare with.
return bool

Equals() public method

Determines if this Date instance and another object hold the same date.
public Equals ( object other ) : bool
other object The instance to compare with.
return bool

GetHashCode() public method

Returns the hash value of the date for hash based data structures and algorithms.
public GetHashCode ( ) : int
return int

IsLeapYear() public static method

Determines if a year is a leap year.
public static IsLeapYear ( int year ) : bool
year int The year to test (1900-2099)
return bool

MonthLength() public static method

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.
return int

MonthLength() public static method

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).
return int

Normalize() public method

Uses the timezone information to create a UTC normalised DateTime from the current instance.
public Normalize ( ) : DateTime
return DateTime

Parse() public static method

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.
return DateTime

ToDate() public method

Creates a Date instance based in the date component values of the current instance.
public ToDate ( ) : Date
return Date

ToString() public method

Converts the instance data members to a string representation that can be displayed for debugging purposes.
public ToString ( ) : string
return string

ToTime() public method

Creates a Time instance based in the date component values of the current instance.
public ToTime ( ) : Time
return Time

Property Details

MAX_VALUE public_oe static_oe property

The latest possible date that can be correctly represented.
public static DateTime MAX_VALUE
return DateTime

MIN_VALUE public_oe static_oe property

The earliest possible date that can be correctly represented,
public static DateTime MIN_VALUE
return DateTime