CX_PERIODIC_DATE

Class hierarchy
Description:

With this class it is possible to display a periodic date - a time period, which repeats in a certain way. The following shows some possible date specifications, that can be realised with an object of this class, including generating instructions. The description of all possible date specifications can be found in the function description for Import.

Code example:

In the example, an input field of the type radio button is linked to the weekday "Monday". The "Monday" is set in DrainWindow if the input field contains a value different to zero, and it gets reset, if it contains the value zero. In FillWindow, equivalently a "1" or a "0" gets passed to the input field.

Radio(CX_PERIODIC_DATE::Mondays(), 10, 10, 125, T("Montag", "Monday"))


In addition to this, there is the function WeekdayEnum(), allowing to set the internal value of a weekday / weekday combination. If for example there are often complicated weekday combinations required, such as "Mondays, Wednesdays, Thursdays and Sundays" or "Mondays to Fridays", it would be hard to enter them with the so far introduced instruments. For these cases it is possible to assign the internal values in a file to text, like exemplary in the following file "weekdays.enm" (Read more about the internal display in the function documentation for Import):

366, T(Montags, Mondays), 0xff
367, T(Dienstags, Tuesdays), 0xff
369, T(Mittwochs, Wednesdays), 0xff
373, T(Donnerstags, Thursdays), 0xff
381, T(Freitags, Fridays), 0xff
397, T(Samstags, Saturdays), 0xff
329, T(Sonntags, Sundays), 0xff
396, T("Montags bis Freitags", "Mondays to Fridays"), 0xff
461, T("Samstags und Sonntags", "Saturdays and Sundays"), 0xff
442, T("Mo, Mi, Do und So", "Mon, Wed, Thu and Sun"), 0xff
492, T("jeder Wochentag", "each weekday"), 0xff
941, T("Sonn- und Feiertags", "Sundays and Holidays"), 0xff

Here, the access function WeekdayEnum() is linked to an input field of the type Enumeration.
Enumeration(CX_PERIODIC_DATE::WeekdayEnum(), 10, 10, 115, 40, "weekdays.enm")

1. "Every second Monday of a month"

Remark: This periodic date shall not be mistaken for "every second Monday of each month starting on the nth Monday of a month".

also see MthWeekdayInMonth

2. "Monday to Friday"

also see NthWeekdayFromTheKthInMonth

3. "On the second last Monday of each month"

also see MthWeekdayInMonth

4. "every month from the 15th until 17th"

also see NthDayFromKthMonthund Setzen der Einzelperiodendauer

5. "Day 300 of each year "

also see MthDayInEachYear

6. "Each ultimo plus the following 3 days "

also see NthDayFromKthMonth und Setzen der Einzelperiodendauer

Screen display

In contradiction to classes such as CX_DATE a periodic date doesn't have its own interface object. Instead, the user can design an entry mask that matches his or her purposes with its contents being placed into the object via available  access function. The figure below shows an exemplary entry  mask for capturing (any) weekday combination. Via radio buttons, the user can generate a periodic date, such as "Wednesdays, Thursdays and Sundays" in the mapping (also see  program code).

 

Using  "standard periods", such as "From Monday to Friday" or "On the weekend" quite often, it is possible to simplify the capture even more applying other input fields. The following figure shows this (program code).

Operators
operator brief description
>, < and = comparing a periodic date with another date

Method list (MDI)
function MA* parameter return brief description
AndHolidays   "and on holidays"
AndNoHolidays   "and on days that are no holidays"
BeforeLastWeekday * setting the "second last weekday of the period"
DateGranularity * Datumsbezugszeitraum setzen
Day * setting a special day
DayConsistsOfWeekdays Does the date include a weekday specification?
DayIsASpecialDay Does the date include a day specification?
Frequency * setting the frequency
Fridays * setting Friday
GenerateDays (OBJECT, OBJECT) COLL generating a day
Granularity * setting the reference period
Import (INTEGER, OBJECT, INTEGER, INTEGER, INTEGER, INTEGER) importing a periodic date
IsCompact INTEGER Is the date "compact"?
IsUndef INTEGER Is the date undefined? 
LastWeekday * setting the "last weekday of the period"
Mondays * setting the month
MonthGranularity * setting the month reference period
MthBeforeLastDayOfMonthInYear (INTEGER, INTEGER) "second last weekday of the m.th month in a year"
MthDayInEachYear (INTEGER, INTEGER) "m.th day of a year"
MthLastDayOfMonthInYear (INTEGER, INTEGER) "last weekday of the m.th month in a year"
MthWeekdayInMonth (INTEGER, INTEGER) "m.th weekday in a month"
MthWeekdayInYear (INTEGER, INTEGER) "m.th weekday in a year"
NthDayFromDate (INTEGER, INTEGER, OBJECT) "n.th day starting on date"
NthDayFromKthMonth (INTEGER, INTEGER, INTEGER) "n.th day starting on month"
NthWeekdayFromDate (INTEGER, INTEGER, OBJECT) "n.th weekday starting on date"
NthWeekdayFromTheKthInMonth (INTEGER, INTEGER, INTEGER) "n.th weekday starting on the k.th of the same month"
NthWeekdayFromTheKthInYear (INTEGER, INTEGER, INTEGER) "n.th weekday starting on the k.th of the same year"
OrHolidays   "or on holidays"
OrNoHolidays   "or on days that are no holidays"
Position * setting a specific position
Saturdays * setting Saturday
ShortImport (INTEGER, INTEGER) importing a periodic date
Sundays * setting Sunday
Thursdays * setting Thursday
Tuesdays * setting Tuesday
Ultimo * setting the ultimo
Undef generating an undefined date
VDuration * setting the duration for one period
VDuration0 * setting the duration for  one day
Wednesdays * setting Wednesday
WeekdayEnum   setting a weekday combination
WeekdayStart * setting a start date
YearGranularity * setting a year reference period
Encompassed   (OBJECT) INTEGER Test, if a date period is completely inside another one.
EndOfPeriod     OBJECT return: end date of a date period
NextDate   (OBJECT, OBJECT) OBJECT the following day inside a date period
NextTerm   (OBJECT) OBJECT the following day inside a date period
Overlap   (OBJECT) INTEGER Test, if a date or another date period overlaps with the date period.
RealEndOfPeriod     OBJECT the later limitation period
RealStartOfPeriod     OBJECT the earlier limitation period
StartOfPeriod     OBJECT start of the period
string   INTEGER CX_STRING provides String-display of the object
* MA = Member Access Function

Data directory (DDI)
data field type reference class I* brief description
dayDescription INTEGER internal  description

Application in AppsWH
module brief description
wrldclck.mod world clock basic module
perdate.mod periodic date test module