Calculate Difference between two Date/time using Calculated value in The forms

  • 28 October 2014
  • 10 replies
  • 216 views

Badge +3

Hi all

I want to calculate the difference between two date/time using calculated value in the form, so that users can be able to see the difference when the view item

I tried using a calculated column but some how I cannot connect the calculated column to the column in the form in order to display/cannot display the column in the form

Regards

Thanks in advance!.


10 replies

Badge +4

Hi Michelle,

There are few ways of doing it.

You can create Form Variable and show that variable into calculated value control. please follow below steps:

  1. Create Form Variable
    1. Click on Form Variable button
    2. Click on formula, it should give you Formula Builder
    3. Select Runtime Functions
    4. Select either dateDiffDays, dateDiffHours or dateDiffMinutes, it depends on which formate you want
    5. Put your both date values
    6. Click Ok
  2. Add Calculated Value control on the form and add newly created variable into formula
  3. Publish form and it should work

Other option is , you can add Calculated Value control on the form and use above mention runtime function directly.

Thanks,

Shirin

Userlevel 5
Badge +12

Here is a pretty good tutorial using date difference already written on the forums:

How to complete Date Validation using Nintex Forms 2013 Validation Rules.

Badge +3

Hi Shirin

Is it possible to make the format like this - 0 days, 01  hrs,  00  mins when calculating the date difference and how do I go about doing that?

Thanks

Badge +4

Hi Michelle,

There are 3 different runtime function (1) dateDiffDays (2) dateDiffHours (3) dateDiffMinutes.

I am sure it will help you to achieve what you after.

Let me know how you go. Let me know if you need help in your specific scenario in this, might try to create form for you and send you.

Thanks,

Shirin

Badge +3

Hi Shirin

Yes I definitely need help please!

Thanks

Badge +4

Hi Michelle,

I have attached exported list form. Please import that and see if it helps.

Let me know if any questions.

Regards

Shirin

Badge +3

Thank you that is what exactly I am looking for

And it helped

Thanks

Badge +5

hello Shirin Patel

i dont know how it works, not sure if the problem is in my form

i imported yours and i also had the same outcome

days: 2

hours: 48

minutes: 2880

i modified it to get the results i wanted like below

dateDiffDays(date1, date2) + "  days  " + (dateDiffHours(date1, date2)-24*dateDiffDays(date1, date2)) + "  hrs  " + (dateDiffMinutes(date1, date2)-(60*dateDiffHours(date1, date2))) + "  mins  "

Badge +5

Hi ‌, can you mark the answer to your question? I think this post would be helpful for other Nintex connect users. grin.png

Badge

Hi

I am designing an overtime form and the user can enter 3 different rows within a repeating section for each day.  I have used the following formula to calculate the hours and minutes worked but I need the total of the 3 entries to work out the total daily hours and minutes worked.

 

(dateDiffHours(StartTime,FinishTime)) + " Hours : " + (dateDiffMinutes(StartTime,FinishTime)-60*(dateDiffHours(StartTime,FinishTime))) + " Minutes"

 

Can anyone please advise what the formula is to calculate the 'sum' of the 3 daily entries?

Thank you

Reply