Exceptions
|
Type Summary
Calendar derived from Calendar |
Overridden Operations: |
Image ,
Year
|
New Operations: |
Add_Months ,
Date ,
Day ,
Day_In_Year ,
Day_Of_Week ,
Easter ,
Image ,
Is_Leap_Year ,
Is_Leap_Year ,
Julian_Day ,
Month ,
Split ,
Split ,
Sub_Months ,
Time_Of ,
Time_Of
|
|
Constants and Named Numbers
|
Other Items:
|
type Calendar is abstract new Util.Calendars.Calendar with null record;
|
The three most important routines here are Julian_Day , Date , and
Image . All the non-abstract primitive operations of this type
re-dispatch to either Julian_Day or Date to convert a Time value
to years, months, and days.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subtype Day_Count is Natural range 1 .. 366;
|
A system in which days are counted. January 1st is 1.
|
|
|
|
|
|
function Easter
(Base : in Calendar;
Year : in Year_Number)
return Util.Times.Time
is abstract;
|
Returns midnight on easter in the given year. May raise Date_Error
if either: the year is negative (there was no easter in B.C...) or the
year is beyond the range of the calendar (e.g., in Gregorian calendars,
you can compute easter dates only from 1583 on).
|
|
function Image
(Base : in Calendar;
Date : in Util.Times.Time;
Format : in Util.Calendar.IO.Date_Format;
Separator : in String := "";
Padding : in Boolean := True;
BC_AD : in Boolean := False)
return String;
|
Individual date components are separated by the given Separator .
If Padding is true, day and month numbers smaller than 10 have a
leading zero.
If BC_AD is False , dates before 1-JAN-1 are written with
a negative year, if it is true , the year always is positive, but BC
dates have " BC" appended. Note that if BC_AD is false,
you get year 0 for 1 BC, -1 for 2 BC, and so on. (There is no year 0,
the year before 1 AD is 1 BC!)
If Format is YMD and BC_AD is True , BC dates are formed by
prepending "BC" & Separator.
Examples: (assuming Padding = True and BC_AD =
False )
|
Format | Separator | 03-OCT-2001
yields: |
English style: | MDY | "/" | "10/03/2001" |
German style: | DMY | ". " | "03. 10. 2001" |
ISO 8601: | YMD | "-" | "2001-10-03" |
Timestamp: | YMD | "" | "20011003" |
Note that there are no image functions with textual representations
for the month and/or the day of the week. This is intentional, for
month and weekday names depend highly on the locale, and it was felt
that such things are better dealt with outside such a general package.
If such functionality were included, where should the limit be? Should
we support Wide_Character strings or not? Should we support different
separators? What about ordinals? (As in the date "Jun 2nd, 2001".)
|
|
function Image
(Base : in Calendar;
Date : in Util.Times.Time)
return String;
|
Override the inherited, abstract operation: returns the ISO 8601 image,
i.e. "YYYY-MM-DD". Same as Image (Base, Date, YMD, "-") ;
|
|