Loading...
 

CX_DATE

CX_DATE  CX_DATE.png

Class hierarchy
Description:

This class is used to manage a current date, such as "3.10.1990". It is possible to enter an incomplete date, such as a birthday ("5 May"). It is also possible to enter an unknown, i.e. undefined, date. (However, not by put!)

A complete date can only be between 01.01.1583 and 01.01.8202. Attempts to set a date outside these fixed limits are acknowledged with an error.

In addition, a further limit can be set via SystemObject::SetDateLimit. However, the above fixed limits can never be exceeded or fallen short of.

Note: A new CX_DATE object is always initialised with the current session date . Only if this is not set, the current system date is used.

Display on the screen:

InstantView® Instruction: Date

When the interface object is initialised, the current session date is taken over. In addition to exact data, incomplete data, such as a date of birth ("5 May") or a completely unknown date, can also be defined. For this purpose, the flag DF_ALLOW_INCOMPLETE_DATE and (DF_EUROPEAN_FORMAT or DF_MILITARY_FORMAT) must be passed to the interface object to allow the processing of such date specifications. The following table shows the possible entries that can be made and what kind of date results:

Input Date Description
"27.1.1997" 27.1.1997 Indication of an exact date.
"27.1.97" 27.1.1997

The two-digit year is added:

  • is added to the two-digit year if the session date is set, so that the date is closest to the current session date.
    So "19" for a session date of "2024", but "20" for a session date of "2075".
  • Otherwise, the current base century, which is defined in the set location-specific data, is added. In this example it is "19".
"5.5" or "5.5." May 5th A missing year is not included or replaced by a character defined in the location-specific data (in this case "?").
"5.13" or "?.5.13" May 1913 If a day is omitted, the "missing sign" need not be indicated if the year is greater than "12".
"the day before yesterday", "yesterday, "today", "tomorrow", "the day after tomorrow"

A tag can be described by linguistic terms. The input is converted into the complete absolute day (e.g. "4.8.2001"). The concrete words depend on the set language.

It is also possible in 198178 to use only the beginning of such a term, if clear. For example, "h" can also be used for "today".

"" or "?...?" undefined date An unknown date.

In connection with this interface object and certain InstantView® instructions, the flags belonging to the object play an important role, as they can be used to modify the representation of the object.

Operators / Arithmetic
Operator Brief description
+, - Arithmetic
>, <, = Compare
Code example:
// Session date interaction Var(date) CreateTransObject(CX_DATE) -> date //-> <current session/system date> "01.03.2020" date Put // change date date SystemObject Call(SetSessionDate) // change session date CreateTransObject(CX_DATE) //-> "01.03.2020" SystemObject Call(SessionDate) //-> "01.03.2020" 10 date Call(AddDay) // set to "11.03.2020" date SystemObject Call(SetSessionDate) // change session date CreateTransObject(CX_DATE) //-> "11.03.2020" NULL SystemObject Call(SetSessionDate) // reset session date CreateTransObject(CX_DATE) -> date //-> <current system date> // Arithmetics Var(birthday, today) CreateTransObject(CX_DATE) -> today CreateTransObject(CX_DATE) -> birthday "24.07.1992" birthday Put today birthday - //-> eg. 10448 Days

List of methods (MDI)
Function MA* Parameters Return Brief description
Detailed information:
DayOfDate INTEGER Day of the date
MonthOfDate INTEGER Month of the date
QuarterOfDate INTEGER Quarter of the date
TertianOfDate INTEGER Tertial of the date
YearOfDate INTEGER Year of date
DecadeOfDate INTEGER Decade of the date
CenturyOfDate INTEGER Century of the date
MillenniumOfDate INTEGER Millennium of the date
Weekly data:
WeekOfDate INTEGER Calendar week of the date
YearOfWeek INTEGER Year of the calendar week of the date
DayOfWeek INTEGER Value of the weekday of the date
DayInWeek INTEGER Weekday position
Monthly data:
DaysInMonth INTEGER Number of days per month
Annual data:
DayOfYear INTEGER Day position in the year
LeapYear INTEGER Shows whether the year is a leap year
Day type specifications:
IsDateType INTEGERINTEGER Is the date a "special day off"?
IsTerm INTEGER Is the date an appointment?
IsAnniversary INTEGER Is the date an anniversary?
IsHoliday INTEGER Is the date a public holiday?
IsVacation INTEGER Is the date a holiday?
IsWorkingday INTEGER Is the date a working day?
TypeOfDate INTEGER Type of date
Date comparisons:
Encompassed INTEGER "Contained in" test
Overlap INTEGER Overlap test
Other:
AgeInDays OBJECT, INTEGERINTEGER Exact difference to another date
AgeInYMD OBJECT VECTOR Exact difference to another date
AgeInFullYears OBJECT OBJECT Rounded annual difference to another date
AgeInCommencedYears OBJECT OBJECT Annual difference rounded up to another date
ExportDateNumber INTEGER, INTEGER STRING Export of the date number as string
ValueOfDate INTEGER internal date value
Monolingual:
WeekdayNameOfDay STRING Name of the weekday
ShortWeekdayNameOfDay STRING abbreviated weekday name
Name Of Month STRING Name of the month
ShortNameOfMonth STRING abbreviated name of the month
NameOfDay STRING (Holiday) name of the day
SpecialNameOfDay INTEGER STRING specific (holiday) name of the day
Multilingual:
MLWeekdayNameOfDay MLSTRING multilingual weekday name
MLShortWeekdayNameOfDay MLSTRING multilingual abbreviated weekday name
MLNameOfMonth MLSTRING multilingual name of the month
MLShortNameOfMonth MLSTRING multilingual abbreviated name of the month
MLNameOfDay MLSTRING multilingual (holiday) name of the day
MLSpecialNameOfDay INTEGER MLSTRING specific multilingual (holiday) name of the day
Detailed information:
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 string
SetDate STRING, INTEGER Import of a string
SetToday Set to session date or current date
SetZero - - sets the date to zero
addition/subtraction:
AddDay INTEGER Daily Addition
AddNetDay INTEGER, INTEGER Daily addition with condition: WORKINGDAY, TERM, ANNIVERSARY, HOLIDAY, VACATION, REST_TERM
AddWeek INTEGER Weekly addition
AddMonth INTEGER Monthly addition
AddYear INTEGER Annual addition
Start/end:
StartOfPeriod OBJECT Start of period
RealStartOfPeriod OBJECT "real" beginning of the period
EndOfPeriod OBJECT End of period
RealEndOfPeriod OBJECT "real" end of period
Date of the day:
Easter OBJECT Easter Sunday calculation
Next INTEGER OBJECT Search for a next specific day of the week
Previous INTEGER OBJECT Search for a previous specific weekday
First INTEGER OBJECT Search for the first (specific) day of the week in the month
Second INTEGER OBJECT Search for the second (specific) day of the week in the month
Third INTEGER OBJECT Search for the third (specific) day of the week in the month
Fourth INTEGER OBJECT Search for the fourth (specific) day of the week in the month
Load INTEGER OBJECT Search for the last (specific) day of the week in the 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 of the week in which the date is
Month OBJECT Return of the month in which the date is
Quarter OBJECT Return of the quarter in which the date is
Tertian OBJECT Return of the tertial in which the date is located
Year OBJECT Return of the year in which the date is
Decade OBJECT Return of the decade in which the date is
Century OBJECT Return of the century in which the date is
Millenium OBJECT Return of the millennium in which the date is
Other:
AbsoluteDayOfYearIndex INTEGER Return of the number of days from the beginning of the year to the current date
Duration OBJECT Return of the period length (duration) of a date period
EndOfPeriodMA * End of period
IsDiffuse INTEGER test whether the date period being transferred is diffuse
IsRepeatedDate (OBJECT) INTEGER test if the two dates are the same (without yearly comparison)
JoinPeriods (OBJECT) OBJECT combine two transferred date periods into one
NextTerm (OBJECT) OBJECT the following day within the date period
OverlappingPeriod (OBJECT) OBJECT calculate the intersection (disjunction) of two date periods
SpanDate (OBJECT, OBJECT) OBJECT Create a date period with the transferred start and end date
StartOfPeriodMA * Start of period
string INTEGER CX_STRING Returns the string representation of the object

* MA = Member Access Function

Data directory (DDI)
Data field Type Reference class I* Brief description
this CX_DATE The date.

* I = Indexable data field

Use in AppsWH
Module Brief description
date.mod Date test module
sessiond.mod Session date Basic module
initsdat.mod Initialisation Module
initbyea.mod Financial year Initialisation Module
initfyea.mod Flexitime year Initialisation Module
initsess.mod Session date Initialisation Module