C# Class System.Globalization.CCFixed

The class implements methods to handle the fixed date value from the "Calendrical Calculations" books.

For implementing the Calendar classes I used the algorithms from the book "Calendrical Calculations" by Nachum Dershowitz and Edward M. Rheingold, second reprint 1998. Trying to prevent the introduction of new bugs, I implemented their algorithms in the N:CalendricalCalculations namespace and wrapped it in the calendar classes.

The fixed day number is also known as R.D. - rata die. Midnight at the onset of Monday, January 1, year 1 (Gregorian) is R.D. 1.

Here are all my references:

[1] Nachum Dershowitz and Edward M. Rheingold: "Calendrical Calculations"; Cambridge University Press; second reprint 1998. [2] P. Kenneth Seidelmann (ed.): "Explanatory Supplement to the Astronomical Almanac"; University Science Books, Sausalito; 1992 [3] F. Richard Stephenson: "Historical Eclipses and Earth Rotation"; Cambridge University Press; 1997
Mostra file Open project: runefs/Marvin Class Usage Examples

Public Methods

Method Description
FromDateTime ( System time ) : int

A static method computing the fixed day number from a T:System.DateTime value.

ToDateTime ( int date ) : System.DateTime

The method computes the T:System.DateTime from a fixed day number.

ToDateTime ( int date, int hour, int minute, int second, double milliseconds ) : System.DateTime

The method computes the T:System.DateTime from a fixed day number and time arguments.

day_of_week ( int date ) : DayOfWeek

The static method computes the T:DayOfWeek.

kd_nearest ( int date, int k ) : int

The static method computes the date of a day of week that is nearest to a particular date.

kday_after ( int date, int k ) : int

The static method computes the date of a day of week after a particular date.

kday_before ( int date, int k ) : int

The static method computes the date of a day of week before a particular date.

kday_on_or_after ( int date, int k ) : int

The static method computes the date of a day of week on or after a particular date.

kday_on_or_before ( int date, int k ) : int

The static method computes the date of a day of week on or before a particular date.

Method Details

FromDateTime() public static method

A static method computing the fixed day number from a T:System.DateTime value.
public static FromDateTime ( System time ) : int
time System A /// value representing the date. ///
return int

ToDateTime() public static method

The method computes the T:System.DateTime from a fixed day number.
public static ToDateTime ( int date ) : System.DateTime
date int A integer representing the fixed day number. ///
return System.DateTime

ToDateTime() public static method

The method computes the T:System.DateTime from a fixed day number and time arguments.
public static ToDateTime ( int date, int hour, int minute, int second, double milliseconds ) : System.DateTime
date int An integer representing the fixed day number. ///
hour int An integer argument specifying the hour. ///
minute int An integer argument specifying the minute. ///
second int An integer argument giving the second. ///
milliseconds double An double argument specifying /// the milliseconds. Notice that /// has 100 nanosecond resolution. ///
return System.DateTime

day_of_week() public static method

The static method computes the T:DayOfWeek.
public static day_of_week ( int date ) : DayOfWeek
date int An integer representing the fixed day number. ///
return DayOfWeek

kd_nearest() public static method

The static method computes the date of a day of week that is nearest to a particular date.
public static kd_nearest ( int date, int k ) : int
date int An integer representing the date as /// fixed day number. ///
k int An integer representing the day of the week, /// starting with 0 for sunday. ///
return int

kday_after() public static method

The static method computes the date of a day of week after a particular date.
public static kday_after ( int date, int k ) : int
date int An integer representing the date as /// fixed day number. ///
k int An integer representing the day of the week, /// starting with 0 for sunday. ///
return int

kday_before() public static method

The static method computes the date of a day of week before a particular date.
public static kday_before ( int date, int k ) : int
date int An integer representing the date as /// fixed day number. ///
k int An integer representing the day of the week, /// starting with 0 for sunday. ///
return int

kday_on_or_after() public static method

The static method computes the date of a day of week on or after a particular date.
public static kday_on_or_after ( int date, int k ) : int
date int An integer representing the date as /// fixed day number. ///
k int An integer representing the day of the week, /// starting with 0 for sunday. ///
return int

kday_on_or_before() public static method

The static method computes the date of a day of week on or before a particular date.
public static kday_on_or_before ( int date, int k ) : int
date int An integer representing the date as /// fixed day number. ///
k int An integer representing the day of the week, /// starting with 0 for sunday. ///
return int