How to get working days between 2 time stamps

Certified Senior Developer

I am calculating time difference between 2 time stamps in   hours: min :sec   format  .

Now my problem is I have to eliminate weekends between 2 time stamps and calculate difference in   hours: min :sec   format  

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to Konduru Chaitanya

    a!localVariables(
      local!MaxDateTimeForAssigned: todatetime(
        rule!ERR_GetMaxDateTimeByStatus(
          statusId: cons!ERR_STATUS[3],
          trackingId: ri!trackingId
        )
      ),
      local!MaxDateTimeForWaitingApproval: todatetime(
        rule!ERR_GetMaxDateTimeByStatus(
          statusId: cons!ERR_STATUS[5],
          trackingId: ri!trackingId
        )
      ),
      local!CycleTime: if(
        or(
          a!isNullOrEmpty(local!MaxDateTimeForAssigned),
          a!isNullOrEmpty(local!MaxDateTimeForWaitingApproval)
        ),
        {},
        local!MaxDateTimeForWaitingApproval - local!MaxDateTimeForAssigned,
        
      ),
      local!format: if(
        a!isNullOrEmpty(local!CycleTime),
        {},
        split(local!CycleTime, ".")[1],
        
      ),
      local!days: if(
        a!isNullOrEmpty(local!format),
        {},
        split(local!format, "::")[1],
        
      ),
      local!hours: if(
        a!isNullOrEmpty(local!format),
        {},
        if(
          local!days = 0,
          split(local!format, ":")[3],
          sum(
            (local!days * 24),
            split(local!format, ":")[3]
          )
        )
      ),
      local!min: if(
        a!isNullOrEmpty(local!format),
        {},
        split(local!format, ":")[4]
      ),
      local!sec: if(
        a!isNullOrEmpty(local!format),
        {},
        split(local!format, ":")[5]
      ),
      local!TotalCycleTime: {
        if(
          and(
            a!isNullOrEmpty(local!hours),
            a!isNullOrEmpty(local!min),
            a!isNullOrEmpty(local!sec)
          ),
          {},
          local!hours & ":" & local!min & ":" & local!sec
        )
      },
      local!TotalCycleTime
    )

    This will not be coming in hours:min: sec format . i already have rule where I can get difference between time stamps but my only problem is to eliminate weekend and get in the hours: min: sec format as output

Children