© serviceprofessionalgmbh

This example demonstrates how simple dealing with dates can be. The purpose of the program is to come up with a new date based on a date (tt.mm.jjjj) and a number of days (positiv or negativ) in the same format as the input date.

To emphasise a point the first example features the ultra short version using nested funtions.

The second example shows the same function (coded more self explaining). It is not our intention to leave you with the impression that under normal circumstances REXX is coded as cryptic as PERL.

/* REXX
   EINGABE: TT.MM.JJJJ,[-]N       AUSGABE: TT.MM.JJJJ
*/
ARG DATUM,TAGE
PARSE VAR DATUM TT "." MM "." JJJJ
PARSE VALUE DATE("S",DATE("B",(JJJJ !! MM !! TT),"S") +TAGE,"B") ,
      WITH 1 JJJJ 5 MM 7 TT
RETURN TT"."MM"."JJJJ



/* REXX
   EINGABE: TT.MM.JJJJ,[-]N       AUSGABE: TT.MM.JJJJ
*/
ARG DAT_G,TAGE
PARSE VAR DAT_G TT "." MM "." JJJJ
DAT_B = DATE("B",JJJJ !! MM !! TT,"S")         /* FORMAT BASE      */
DAT_B = DAT_B + TAGE                           /* BASE NEW         */
DAT_S = DATE("S",DAT_B,"B")                    /* BACK TO SORTED   */
PARSE VAR DAT_S 1 JJJJ 5 MM 7 TT
RETURN TT"."MM"."JJJJ
back to Date &Time