|
|
|
| Listing 5.4 | |
|
|
|
|
if (bcad_ind)
{
if (year < 1)
{
year = (1 - year);
sprintf (s, "%d %s %d B.C.", year, month_name (month), day);
}
else
sprintf (s, "%d %s %d A.D.", year, month_name (month), day);
}
else
sptintf (s, "%d %s %d", year, month_name (month), day);
return;
}
|
|
|
|
|
|
|
| Listing 5.5 format_date_military() | |
|
|
|
|
/* fmdtmdmy.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Formats a date into a string, using the military convention of DMY, or
Day-Month-Year (DD MMM YYYY) order. The formatted string contains a
standard abbreviated month name. The month name is an abbreviation of
the English month name. E.g., Day = 2, Month = 1, Year = 1999 produces
a string "02 JAN 1999".
INPUTS:
1. d, pointer to DATE_INFO, the date to be formatted.
OUTPUTS:
1. s, string, the formatted date.
NOTES:
1. Note that there is no year 0, by common usage. Therefore, years prior
to the year 1 represent dates 'B.C.'. A year '-N' is output by this
routine as '-N'. E.g., year -4712 represents year 4713 B.C., and is
output by this routine as -4712. This routine explicitly outputs 0
for year 0. This routine does NOT output a 'B.C.' or 'A.D.' suffix,
unlike the 'format_date_alpha' routines.
|
|
|
|
|
|
|
|