CX_SPAN_DATE

Class hierarchy
Description:

This class consists of a Date (CX_DATE) and a Duration in a time measuring unit (Duration, CX_VALUE). It can be interpreted in different ways: as an interval (time period), with the date representing the start, and the date + duration adding the duration providing the end. As a process, it starts with the date with the effort being saved in the duration. This effort can also be 0 or negative.

For these two cases, there are still flags in the value validEnum covering special cases: On the one hand, it is possible to determine, that an interval is infinite or half-infinite (start or end are missing). On the other hand, the duration can also refer to special days only (such as working days) (net), instead of all days (gross). These modes are mutually exclusive: if the date period is (half-) infinite, the duration is not relevant (duration in theory: infinite). If it is a net duration, the date period has to be limited.

The duration doesn't need to be specified in days. A specification is also possible in weeks, months, years etc.. If the date is at the start of such a period, it is called a diffuse date period. In this case, the date period stands for a specific number of periods in the higher-level unit. There is also a limitation referring to the modes: a diffuse date period is always limited and gross. In specific arithmetic operations, such as the setting of the start date, it might be required to convert the duration into single days.

The date is -just like every date- initialised with the current date. By default, the duration is set for 1 day. The standard mode is gross and limited (FROM_TO). In a way, every simple Date can be seen as a date period: many functions that have been designed for a date period, are also applicable for a date. This implies a duration of one day.

While a date can be incomplete, a date period requires at least a year specification. It is not possible to define periods such as "April-May" or "1.-15.".

Code example:

1. "On the 10.1.1996" (DD/MM/YYYY)

2. "10.1.1996 until 12.1.1996" (DD/MM/YYYY)

3. "2nd quarter 1994"

4. "from WK 14 until WK 17 1996"

5. "From the 20.5.1996" (DD/MM/YYYY)

Screen display:

To display objects of this class, there are the following possibilities:

1. Using an interface object of the type string.

In this case, the object is specified in a single input field. Just like entries of the type "start date - end date" it is also possible to make specifications such as "2nd quarter 1996". Entries of the type "4CW96-7CW96" (="starting with the start of the 4th calendar week until the end of the 7th calendar week 1996") are also supported. The following table shows all possible presentations. Please consider that year specifications entered as two-digit numbers get added to the base century of the current setting. The unit specification, e.g. "m" for month depends on the setting of system units. That way, it is possible to also write "month" instead of "m". Space character and dots are optional, e.g. " 2nd quarter 1996" can also be written as "2quarter1996" or "2Q96".

entry date
start - end start date until end date
n WK year nth calendar week in the year year
n m year nth month in the year year
n q year nth quarter in the year year
n t year nth tertian in the year year
year the year year
n Jz m nth decade in the mth century
n Jh nth century
n Jt nth millennium

Remark: Entering a date period, start- and end date are separated by one of the following characters: '-', '·' or '/'.

The following pictures display some examples (Program Code):

2. Using two interface objects of the type date

One field is for the start date and the other one for the end date (Program Code). It needs to be considered, that without additional interface objects, it is only possible to administer defined start- and end dates. That way, specifications such as "from 3.10.1990" (DD/MM/YYYY) are not possible.

3. Using the interface objects Date and String

The first interface object specifies the start date and the other one the duration (Program Code). It needs to be considered, that without additional interface objects, it is only possible to administer defined start- and end dates. That way, specifications such as "from 3.10.990" (DD/MM/YYYY) are not possible.

In connection with these display options and specific InstantView® statements, the specific object Flags play an important role, since they can modify the object display.

Operators
Operator Description
+, -, *, / arithmetics
>, <, = comparisons

Method Dictionary (MDI)
Function MA* Parameter Return Brief Description
particulars:
ValueOfDate     INTEGER internal date value
Duration OBJECT period duration
day specifications:
DayOfDate   INTEGER date day
WeekOfDate     INTEGER date week
MonthOfDate     INTEGER date month
QuarterOfDate     INTEGER date quarter
TertianOfDate     INTEGER date tertian
YearOfDate     INTEGER date year
DecadeOfDate     INTEGER date decade
CenturyOfDate     INTEGER date century
MilleniumOfDate     INTEGER date millennium
week specifications:
DayOfWeek     INTEGER date weekday
DayInWeek     INTEGER weekday position in reference to the start of the working week
YearOfWeek     INTEGER week year
month specifications:
DaysInMonth     INTEGER amount of days in a month
Jahresangaben:
DayOfYear     INTEGER day position in a year
mono-lingual:
WeekdayNameOfDay STRING weekday name
ShortWeekdayNameOfDay STRING abbreviated weekday name
NameOfMonth STRING month name
ShortNameOfMonth STRING abbreviated month name
NameOfDay STRING (holiday-) name
SpecialNameOfDay INTEGER STRING special (holiday-)name
 
multilingual:
MLWeekdayNameOfDay     MLSTRING multilingual weekday name
MLShortWeekdayNameOfDay     MLSTRING multilingual abbreviated weekday name
MLNameOfMonth     MLSTRING multilingual month name
MLShortNameOfMonth     MLSTRING multilingual abbreviated month name
MLNameOfDay     MLSTRING multilingual (holiday-)name
MLSpecialNameOfDay   INTEGER MLSTRING multilingual special (holiday)name
conversion:
ImportDateNumber   STRING, INTEGER   importing the date number as a string
ExportDateNumber   INTEGER, INTEGER STRING exporting the date number as a string
ImportObject OBJECT setting (start-)date
day type specifications:
IsDateType   INTEGER INTEGER Is the date a "special free day"?
IsTerm     INTEGER Is the date a term?
IsAnniversary     INTEGER Is the date an anniversary?
IsHoliday     INTEGER Is the date a holiday?
IsVacation     INTEGER Is the date a vacation day?
IsWorkingday     INTEGER Is the date a working day?
TypeOfDate     INTEGER date type
LeapYear     INTEGER Is the date a leap year?
IsDiffuse INTEGER Is the duration not specified in days?
date comparisons:
Encompassed OBJECT INTEGER "encompassed by"-test (conjunction)
Overlap OBJECT INTEGER overlap-test (disjunction)
AgeInYMD   OBJECT VECTOR<OBJECT> exact difference to another date
AgeInFullYears   OBJECT OBJECT year difference to another date, rounded down
AgeInCommencedYears   OBJECT OBJECT year difference to another date, rounded up
relative specifications:
First   INTEGER OBJECT first weekday in the month
Second   INTEGER OBJECT second weekday in the month
Third   INTEGER OBJECT third weekday in the month
Fourth   INTEGER OBJECT fourth weekday in the month
Last   INTEGER OBJECT last weekday in the month
Previous   INTEGER OBJECT search for the previous specific weekday
Next   INTEGER OBJECT search for the next specific weekday
NextDate   OBJECT OBJECT the following day inside a date period
NextTerm   OBJECT OBJECT the following day inside a date period (as DateTime)
Easter OBJECT calculating Easter Sunday
generating an object:
Day   INTEGER, INTEGER OBJECT generating a date in the current year
Date   INTEGER, INTEGER, INTEGER OBJECT generating an exact date
SpanDate OBJECT, OBJECT OBJECT generating an exact date period
Week     OBJECT generating a calendar week
Month       generating a month
Quarter       generating a quarter
Tertian       generating a tertian
Year       generating a year
Decade       generating a decade
Century       generating a century
Millenium       generating a millennium
paritculars:
SetDay   INTEGER   setting of a new day
SetMonth   INTEGER   setting of a new month
SetYear   INTEGER   setting of a new year
SetZero setting to "unlimited"
start/end:
StartOfPeriod     OBJECT start of a period
EndOfPeriod     OBJECT end of a period
StartOfPeriodMA *     start of a period
EndOfPeriodMA *     end of a period
RealStartOfPeriod     OBJECT earlier limitation period
RealEndOfPeriod     OBJECT lateer limitation period
FirstPeriod OBJECT first sub-period
LastPeriod OBJECT last sub-period
SetStartOfPeriod OBJECT setting the start date changing the period duration
SetEndOfPeriod OBJECT setting the end date changing the period duration
MoveStartOfPeriod (MovePeriodToStartDate) OBJECT setting the start date without changing the period duration
MoveEndOfPeriod (MovePeriodToEndDate) OBJECT setting the end date without changing the period duration
SetRealStartOfPeriod OBJECT setting the earlier date changing the period duration
SetRealEndOfPeriod OBJECT setting the later date changing the period duration
MoveRealStartOfPeriod OBJECT setting the later date without changing the period duration
MoveRealEndOfPeriod OBJECT setting the later date without changing the period duration
SetPeriodBorders OBJECT, OBJECT setting the start- and end date
addition/subtraction:
AddDay   INTEGER   day addition
AddNetDay INTEGER, INTEGER Addiert so viele Tage, dass das Datum um die angegebene Anzahl an Tagen in der gegebenen Tageskategorie verschoben wird
AddWeek   INTEGER   week addition
AddMonth   INTEGER   month addition
AddYear   INTEGER   year addition
Set operations:
JoinPeriods OBJECT OBJECT create a unification (conjunction) out of two date periods
OverlappingPeriod OBJECT create an intersection (disjunction) out of two date periods
duration/net/gross:
Duration OBJECT period duration (depends on the day category)
SetDuration OBJECT setting the period duration (becomes gross)
NetDuration INTEGER OBJECT net-period duration (for each day category)
SetNetDuration OBJECT, INTEGER setting the period duration for a day category
GrossDuration OBJECT gross-period duration (not dependant on day category)
SetGrossDuration OBJECT setting the period duration without day category
RealDuration OBJECT period duration (positive, even if StartOfPeriod comes after EndOfPeriod)
SetRealDuration OBJECT setting the period duration, keeping the algebraic sign
DurationMA * period duration
GrossDurationMA * gross-period duration (not dependant on day category)
RealDurationMA * period duration (positive, even if StartOfPeriod comes after EndPeriod)
IsNet INTEGER INTEGER Is the day category (net-type) set?
GetNet INTEGER day categories (bit field)
SetNet INTEGER setting a day category
string   INTEGER CX_STRING provides the string display of the object
* MA = Member-Access function

Data dictionary (DDI)
data field type reference class I* brief description
this CX_DATE basic point in time
duration CX_VALUE Period length. Can be every unit, that can be converted into days; doesn't need to be positive. Which days it includes depends on the net type ab. (also see function duration)
validEnum INTEGER bit 0-1:
type of time period: 
"0" = time period with start and end (FROM_TO)
"1" = start, but there is no end (FROM)
"2" = end, but there is no start (TO)
"3" = infinite time period without start and end (ENDLESS)
bit 2-7:
day categories, which the duration refers to. A set bit means: the particular category is taken out of the duration.
If none of these bits is set (default), the duration is gross, and therefore encloses all days between start and end.
The case: all bits set - doesn't exist. This would mean, that no day is part of the duration. The bits (categories) in detail (also see date type constants):
2: [Is]Term, but not cat. 6
3: [Is]Anniversary, but not cat. 2,6
4: [Is]Holiday, but not cat. 2-3,6
5: [Is]Vacation, but not cat. 2-4,6
6: [Is]Workingday
7: [Is]Rest: every day that doesn't belong to cat. 2-6 (possibly empty)
* I = indicateable data field

Application in AppsWH
module brief description