How can we get difference between two times ?

Hi All,

I am having two times saves in 2 variables 

Eg: 1)  2/5/2023 9:00 AM GMT+05:30.  2)   2/5/2023 8:00 PM GMT+05:30

now my ask is what function we should use in order to get the output like output : 11 hrs or in minuts

and also same for dates 

Thank you 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    After.. decrypting.. your question, I understood that you want to find the difference in time between 2 date/dateTime values, here you go mate; this should help:

    a!localVariables(
      local!firstDateTime: now(),
      local!secondDateTime: subtractminutes(subtracthours(now(), 4), 15),
      local!timeDifference: elapsedtime(
        local!secondDateTime,
        local!firstDateTime
      ),
      a!map(
        mintuesDifference: local!timeDifference[5],
        hoursDifference: local!timeDifference[4],
        dateDifference: elapseddays(
          local!secondDateTime,
          local!firstDateTime
        ),
        hoursWithMinutes: time(
          local!timeDifference[4],
          local!timeDifference[5]
        )
      )
    )

    also consider checking these sections for later requirements on date manipulations. 

  • 0
    A Score Level 1
    in reply to Yanal

    Thank you for the answer elapseddays() function is not avaliable 

Reply Children