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 likhithan

    You are not supposed to replace the complete value from the local!date1. I have mentioned the place where your date should be added.

    a!localVariables(
      local!date1: tointeger(
        (
          datetime(2024, 4, 11, 13, 24, 41, 0) - todatetime("01/01/1970")
        ) * 24 * 60 * 60
      ),
      local!date2: tointeger(
        (
          datetime(2024, 4, 15, 13, 24, 41, 0) - todatetime("01/01/1970")
        ) * 24 * 60 * 60
      ),
      local!difference: local!date2 - local!date1,
      local!days: rounddown(local!difference / 86400, 0),
      local!hours: rounddown(mod(local!difference / 3600, 24), 0),
      local!minutes: rounddown(mod(local!difference / 60, 60), 0),
      local!sec: rounddown(mod(local!difference, 60), 0),
      concat(
        local!days,
        " Days",
        " ",
        local!hours,
        " Hours",
        " ",
        local!minutes,
        " Mins",
        " ",
        local!sec,
        " Secs"
      )
    )

Children