Question Time Function in Progress 4GL

varunvarunks

New Member
I would like to insert 2 shift timings to the code.
  1. (First Shift) Shift starts from 8:00:00:000 to 19:59:59:999
  2. (Second Shift) Shift Starts from 20:00:00:000 to next day 7:59:59:999
I need to get the above exact data to be added to the below code. Please help. Below is the code:

IF TIME < (20 * 60 * 60) THEN DO:
ASSIGN StartDDT = dt_tm2dec(DATE(TODAY), 0)
EndDDT = dt_tm2dec(DATE(TODAY),19 * 60 * 60 + 59 * 60 + 59).
END.
ELSE DO:
ASSIGN StartDDT = dt_tm2dec(DATE(TODAY),20 * 60 * 60).
EndDDT = dt_tm2dec(DATE(TODAY + 1),07 * 60 * 60 + 59 * 60 + 59).
END.
 

TomBascom

Curmudgeon
As I said on Stackoverflow - the conditions you specified can be written as:

Code:
    if ( time >= ( 8 * 60 * 60 )) and ( time < ( 20 * 60 * 60 )) then 
      do:
        message "first shift".
      end.
     else
      do:
        message "second shift".
      end.
 
Top