< previous page page_77 next page >

Page 77
JD0_to_gregorian () returns the DATE_INFO date for a given Julian Day number (type double) and is valid only for dates within the Gregorian calendar system.
JD0_to_julian () returns the DATE_INFO date for a given Julian Day number (type double) and is valid only for dates within the Julian calendar system.
JD0_to_date () converts a Julian Day number to a corresponding date in the Western (Julian and Gregorian) calendar system.
The functions that convert Julian Day number to and from calendar date are the most important functions for a given calendar. You may say that a calendar is "solved" once these two functions are written and tested. All other functions are essentially auxiliary to these core routines.
5.5
Julian Day Applications
This section discusses functions that use the Julian Day number in ways other than converting to and from calendar date.
5.5.1
Day of the Week
These functions use the Julian Day number in applications concerned with the day of the week (DOW). In addition to the two functions discussed below, DOW functions include the following:
day_of_week_index () returns the day of the week index for a given DATE_INFO date in the Gregorian calendar system.
day_of_week_index_JD0 () returns an integer from 0 to 6 as an index for the day of the week of a given Julian Day number.
is_day_of_week () is a utility routine that determines whether a particular date falls on a particular day of the week.
The day_of_week_name () function (Listing 5.8, page 95) provides the names of the days of the week in English. If another language is desired, the names may be substituted in this function, or (better) another function written for the other language, using this function as a template. Care should be taken to observe the required buffer lengths. Different languages also present different problems, since some require accents or other orthographic marks either not available in the ASCII character set or that may create problems with compatibility, displays, or printers.
The ordering of the indices used as the input argument to this function implies an ordering of the days beginning with Sunday, because this is the traditional first day of the week in the Western calendar and the ordering scheme used by SCDTL. Because the week is a cycle, this implied order is not a practical constraint and creates no requirement that the days of the week be presented in any particular order in a given application.

 
< previous page page_77 next page >