|
|
|
| Listing 5.3 | |
|
|
|
|
*/
int gregorian_leap_year (int year)
{
if ( (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0) )
return (1);
else
return (0);
}
|
|
|
|
|
|
|
| Listing 5.4 format_date_alpha_YMD() | |
|
|
|
|
/* fmdtaymd.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Formats a date into a string, using the Japanese convention of YMD, or
Year-Month-Day order. The formatted string displays the month name.
E.g., Day = 2, Month = 1, year = 1789 produces a string "1789 January 2".
An option allows the routine to correctly output B.C. and A.D. suffixes.
Month names are in English.
INPUTS:
1. d, pointer to a DATE_INFO structure containing the date to be
formatted.
2. bcad_ind, type int, indicator determining whether the year is output
'as is', or with 'B.C.' or 'A.D.' suffix. This indicator allows dates
over the full range of the Julian and Gregorian calendars to be input.
E.g., year -4712 can be output as '-4712', or as '4713 B.C.', and year
1992 can be output as '1992' or as '1992 A.D.'.
Values of bcad_ind are:
0 = output date string without 'B.C.' or 'A.D.' suffix.
non-0 = output date string with 'B.C.' or 'A.D.' suffix.
The header file "scdtl_1.h" contains definitions for these values,
as:
0 = BCAD_OFF
|
|
|
|
|
|
|
|