CX_DATE

Class hierarchy
Description:

This class administers a date, e.g. "3.10.1990" (DD/MM/YYYY). It is possible to enter an incomplete date, such as a birthday ("May 5th"), or an unknown, undefined date.

A complete date can only be between 1.1.1583 and 1.1.8202 (DD/MM/YYYY). The attempt to specify a date outside these fixed limits causes an error.

Additionally, it is possible to specify another limitation via SystemObject::SetDateLimit. However, the fixed limits above cannot be exceeded in any case.

Screen display:

InstantView® statement: date

Initialising the interface object, the current system date gets carried over. As well as exact specifications it is also possible to define incomplete dates, such as a birthday ("May 5th") or a completely unknown date. For this, the flag DF_ALLOW_INCOMPLETE_DATE / DF_ALLOW_ZERO_DATE has to be passed to the interface object, to allow for the processing of such date specifications. The following table shows the possible entries and their results:

entry date description
"27.1.1997" (DD/MM/YYYY) 27.1.1997 exact date specification
"27.1.97" (DD/MM/YYYY) 27.1.1997

(DD/MM/YYYY)

The current century, which is defined in the site-specific data of the current setting, is automatically added to a two-digit year specification. In this example, it is "19".
"5.5" / "5.5.?" (DD/MM/YYYY) May 5th A missing year is either not specified or it is replaced by a character, which has been defined in the site-specific data (in this case "?").
"5.13" / "05.13" (DD/MM/YYYY) May 1913 A missing day specification, doesn't require a replacement character, if the year specification is larger than "12".
"the day before yesterday", "yesterday", "today", "tomorrow", "the day after tomorrow" A day can be described with words. The entry gets converted into the complete, absolute day (e.g. "4.8.2001" (DD/MM/YYYY)). The concrete words depend on the language setting.
"" or "?.?.?" undefined date An unknown date.

The flags that belong to this object, play an important role in connection with this interface object and certain InstantView® statements, since they can modify the object display.

Operators/Arithmetics
Operator Brief Description
+, - arithmetics
>, <, = comparisons
Code example:

Date(CX_ASSET_TXN::start.date, 130, 77, 80)
  [ CURRENT: CreateTransObject(CX_DATE) Dup GetObject = if
             {
               -> tmp
               GetObject(, purchase.date) tmp Put
               1 tmp Call(SetDay)
               tmp Call(MonthOfDate) 6 > if 7 else 1 tmp Call(SetMonth)
               tmp PutObject
             } else Drop
  ]

Method Dictionary (MDI)
Function MA* Parameter Return Brief Description
single specifications:
DayOfDate INTEGER date day
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:
WeekOfDate INTEGER date week
YearOfWeek INTEGER date week year
DayOfWeek INTEGER value for the  date weekday
DayInWeek INTEGER weekday position
month specifications:
DaysInMonth INTEGER amount of days in a month
year specifications:
DayOfYear INTEGER day position in a year
LeapYear INTEGER indicates, whether year is a leap year
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
date comparisons:
Encompassed     INTEGER "encompassed-by" test
Overlap     INTEGER overlap test
others:
AgeInDays OBJECT, INTEGER INTEGER exact difference to another date
AgeInYMD OBJECT VECTOR<OBJECT> exact difference to another date
AgeInFullYears OBJECT OBJECT difference to another date rounded down
AgeInCommencedYears OBJECT OBJECT difference to another date rounded up
ExportDateNumber INTEGER, INTEGER STRING date number export as a string
ValueOfDate INTEGER internal date value
monolingual:
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 day of the month
MLShortNameOfMonth MLSTRING multilingual abbreviated name of the month
MLNameOfDay MLSTRING multilingual (holiday-)name of the day
MLSpecialNameOfDay INTEGER MLSTRING special multilingual (holiday-)name of the day
single specifications:
SetDay INTEGER
setting a new day
SetMonth INTEGER setting a new month
SetYear INTEGER setting a new year
ImportDateNumber STRING, INTEGER import of a date number as a string
SetDate STRING, INTEGER string import
SetToday setting to session date / date
SetZero - - sets date to zero
addition/subtraction:
AddDay INTEGER day addition
AddNetDay INTEGER, INTEGER day addition with condition: WORKINGDAY, TERM, ANNIVERSARY, HOLIDAY, VACATION, REST_TERM
AddWeek INTEGER week addition
AddMonth INTEGER month addition
AddYear INTEGER  year addition
start/end:
StartOfPeriod OBJECT start of a period
RealStartOfPeriod OBJECT "real" start of a period
EndOfPeriod OBJECT end of a period
RealEndOfPeriod OBJECT "real" end of a period
date:
Easter     OBJECT calculating Easter Sunday
Next INTEGER OBJECT search for the next specific weekday
Previous INTEGER OBJECT search for the previous specific weekday
First INTEGER OBJECT search for the first (specific) weekday in a month
Second INTEGER OBJECT search for the second (specific) weekday in a month
Third INTEGER OBJECT search for the third (specific) weekday in a month
Fourth INTEGER OBJECT search for the fourth (specific) weekday in a month
Last INTEGER OBJECT search for the last (specific) weekday in a month
Day INTEGER, INTEGER OBJECT calculates another day in the same year
Date INTEGER, INTEGER, INTEGER OBJECT calculates a specific date
periods:
Week OBJECT return date week
Month OBJECT return date month
Quarter OBJECT return date quarter
Tertian OBJECT return date tertian
Year OBJECT return date year
Decade OBJECT return date decade
Century OBJECT return date century
Millenium OBJECT return date millennium
others:
AbsoluteDayOfYearIndex INTEGER return number of days between start of the year and current date
Duration     OBJECT return period length (duration) of a date period 
EndOfPeriodMA * end of period
IsDiffuse     INTEGER check, if passed date period is diffuse
IsRepeatedDate (OBJECT) INTEGER check, if the two dates are equal (without year comparison)
JoinPeriods   (OBJECT) OBJECT join two passed date periods
NextTerm (OBJECT) OBJECT the following day inside a date period
OverlappingPeriod   (OBJECT) OBJECT calculate the intersection (disjunction) of two date periods
SpanDate   (OBJECT, OBJECT) OBJECT generate a date period with the passed start and end date
StartOfPeriodMA * start of period
string   INTEGER CX_STRING provides object string display
* MA = Member-Access-Funktion

Data Dictionary (DDI)
Data Field Type Reference Class I* Brief Description
this CX_DATE the date
* I = indicateable data field

Application in AppsWH
Module Brief Description
date.mod date test module
sessiond.mod session date basic module
initsdat.mod initialisation module
initbyea.mod business year initialisation module
initfyea.mod flex time year initialisation module
initsess.mod session date initialisation module