- This is not the released version of the documentation. Recommended Version
Absolute time
The classes dealing with date and those dealing with time have many similarities. These classes descend from more abstract classes implementing the notion of value (TIME_VALUE , DATE_VALUE , DATE_TIME_VALUE ). From this notion come two kinds of heirs which are the absolute notion of time (classes DATE , TIME and DATE_TIME ) and the notion of duration (classes DATE_DURATION , TIME_DURATION , DATE_TIME_DURATION ).
DATE , TIME and DATE_TIME inherit from the deferred class ABSOLUTE. These classes model absolute temporal values, i.e., specific times and dates. Because <, <=, >, and >= are available on instances of ABSOLUTE and its descendants.
Note: The associated library "time" (also "time_german" and "time_french") are part of the distribution located at $ISE_LIBRARY\library\time\time.ecf and is also available by linking with the IRON repository.
TIME
TIME models times of day, supporting queries:
Creation
There are three ways to create an instance of the class
Origin and cyclic representation
The origin for instances of
Comparison
Instances of TIME may be compared. Functions <, <=, >, and >= are available for ordering instances. Function
Measurement
The query
The query
The feature
Operations
- Set values for
hour ,minute , andsecond withset_hour ,set_minute , andset_second . Arguments must satisfy the rules of creation. - Add hours, minutes, and seconds with features
hour_add ,minute_add , andsecond_add . Featuresadd and+ take an instance of TIME_DURATION as an argument and add it to the current time. - Adjust an instance of
TIME to the next or the previous hour, minute, or second with featureshour_forth ,hour_back ,minute_forth ,minute_back ,second_forth , andsecond_back . It is more efficient to use these features rather than the addition commands listed above (e.g.,hour_back will outperformhour_add (-1) ).
DATE
Creation
There are three ways to create an instance of the class
Origin
The origin for instances of
Comparison
Instances of <, <=, >, and >= are available for ordering instances by value. Function
Measurement
Each instance of
Status Report
You can obtain information about instances from status reporting queries. Some examples are:
-
leap_year isTrue if the instance is a leap year. -
year_day returns the number of days from the beginning of the year to this instance. So, for example, for the date January 31,year_day would return 31. For February 1,year_day would return 32. -
day_of_the_week returns the number of days the instance is from the beginning of the week. Values range from 1 (Sunday) through 7 (Saturday).
Operations
- Set
year ,month , andday withset_year ,set_month , andset_day . Arguments must satisfy the rules of creation. These rules are more complicated than those ofTIME . For example you cannot set day to 31 if the current month is April, whereas you can if the month is January. These restrictions also apply tomake . Similarly for years: you cannot setyear to a non-leap year if the current date is February 29th. However, two features are available to set month and year even if day is too large:set_month_cut_days andset_year_cut_days will cutday down to the largest value allowed. - Add years, months and days with features
year_add ,month_add , andday_add . There is no restriction on adding a year or a month. However, these features have to return a correct result, i.e., the day is checked before each addition. Adding one month to August 31st will yield September 30th. 31 is cut to 30 since there are only 30 days in September. Featuresadd and+ take an instance of DATE_DURATION as an argument and add it to the instance ofdate . It is written so that years and months are added first, the days last.(see DATE_DURATION below) - Move to the next or the previous year, month or day with features
year_forth ,year_back ,month_forth ,month_back ,day_forth , andday_back . It more efficient to use these features than the addition commands (e.g.,year_back performs better thanyear_add (-1) ). - Features
relative_duration anddefinite_duration return the duration between the current date and the argument.relative_duration returns a result which is canonical (See Duration), whiledefinite_duration returns a definite result which may be not canonical.For example, suppose date1 is April 20th and date2 is May 28th. Both features will yield instances of DURATION; however,relative_duration will yield 1 month and 8 days whereas definite_duration will yield 38 days.
DATE_TIME
DATE_TIME provides a combined date and time.
Creation
There are several ways to create an instance:
- Choose values for each of the attributes of the date and the time (
make ). - Get the current date and time from the system (
make_now ). - Associate an instance of
DATE with an instance ofTIME (make_by_date_time ).
Caution: The creation procedure
- Encapsulate an instance of
DATE (make_by_date ). The attribute time is set to the origin, i.e. 0:0:0. The attributedate is set with the same reference as the argument (See caution just mentioned above).
Origin
The origin for instances of
Access
An instance of
Comparison
Instances of <, <=, >, and >= are available for ordering instance by value. Function
Measurement
Element change
It is possible to change reference of
Operations
Add hours, minutes, and seconds with features
Caution: Using the addition features from
Feature
Info: Adding the time duration first would yield undesirable results in rare cases such as in this example: the current date/time is August 30th 23:59:59. The duration being added is one month and one second. Applying feature
Feature
Obtaining a DATE from a DATE_TIME and vice versa
Obtaining an instance of
You can ask for a new instance of