cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate the time difference in Syclo

neha_mahanty
Active Participant
0 Kudos

Hi All,

I want to calculate the total time taken in hours while working on a scenario ie .. diff ( End date time - Start date time)

Now I am a bit confused that the result which I am getting is in milliseconds or seconds .

Can anyone please clarify so that I can make the calculation to convert the time in hours .

Also , should I convert the date time in integer value and then do the calculation or direct difference between the date and time will be fine ?

Please advise.

Thanks

Neha

Accepted Solutions (1)

Accepted Solutions (1)

sudhiranjan_lenka
Contributor
0 Kudos

Hi Neha,

The difference of two Date & Time will give result in seconds but in case of two Dates the result will be in days.

Direct difference of Date & Time type properties will also work fine.

Thanks,

Sudhir.

neha_mahanty
Active Participant
0 Kudos

Thanks Sudhir,

I tested this rule

first date and time field - 7:52:30 PM 11/25/2014

second date and time field - 7:52:56 PM 11/25/2014

and difference it gave it -63584164349.. So how should I move further If I want to convert this in hours  or minutes , Ideally if we see the diff is just 26 seconds.

Can you please explain.

Thanks

Neha

neha_mahanty
Active Participant
0 Kudos

Hi Sudhir,

I modified the rule as

Abs

(Diff

    Time

          DateandTime1

     Time

         DateandTime2

)

This rule is giving me the time in seconds. Can you please confirm if the rule structure is fine ?

Thanks

Neha

sudhiranjan_lenka
Contributor
0 Kudos

Hi Neha,

I guess, It would not work for two different days as follows.

e.g. DateandTime1 =27/11/2014 9:20 pm

          DateandTime2 =26/11/2014 7:00 pm

Please test the scenario, If it gives actual result then It's fine.

Thanks,

Sudhir.

neha_mahanty
Active Participant
0 Kudos

Hi Sudhir,

You are right the rule did not worked.

I am not able to understand the values which is coming in result. All I want to achieve is time difference between 2 date and time fields, and if the result is coming in seconds, milliseconds?

Please guide

Thanks

Neha

neha_mahanty
Active Participant
0 Kudos

Hi ,

I am attaching the rule and 2 transactions. I am not able to calculate if the result is coming correctly and in seconds?

Please suggest

sudhiranjan_lenka
Contributor
0 Kudos

Hi Neha,

please make a small change in your rule as attached, which will give you result in seconds and then you have to write your own logic to find the duration.

Thanks,

Sudhir.

Answers (0)