Progress Date function

Nicky Nikit

New Member
Hi All, i would like to change the current date v_yearenddate to move 5 business days later, please find the code below please help

V_yearenddate = Date(12,31,YEAR(TTbatch.cycledate)
 

Osborne

Active Member
As BobyIsProgress posted, increase the date by 1 and check if the new date is a business day:
Code:
DEFINE VARIABLE V_yearenddate AS DATE NO-UNDO.
DEFINE VARIABLE V_businessdays AS INTEGER NO-UNDO.

V_yearenddate = Date(12,31,YEAR(TTbatch.cycledate)).
DO WHILE TRUE:
   V_yearenddate = V_yearenddate + 1.
   // Check the date is not a Saturday, Sunday, Easter, Christmas etc.
   IF WEEKDAY(V_yearenddate) > 1 AND
      WEEKDAY(V_yearenddate) < 7 AND
      notHoliday() // user defined function to check if date is a holiday
      THEN DO:
      V_businessdays = V_businessdays + 1.
      IF V_businessdays = 5 THEN
         LEAVE.
   END.
END.

DISP V_yearenddate.
 
Top