Jump to content
  • 0

Get the duration using a Calculated Field



2 answers to this question

Recommended Posts

  • 0

Hi @astroboy,

If you're using a submission form and you want to save the result in the table you need to add a field where you will store the result. Set the form element of that specific field to Calculated Value and paste this formula:

CONVERT(VARCHAR, ABS(DATEDIFF( mm, [@field:StartDate], [@field:EndDate]) / 12)) + " Year(s) "
CONVERT(VARCHAR, ABS(DATEDIFF( mm, [@field:StartDate], [@field:EndDate]) % 12)) + " Month(s) "
CONVERT(VARCHAR,ABS(DATEDIFF( dd, DATEADD( mm, DATEDIFF( mm, [@field:StartDate], [@field:EndDate]), [@field:StartDate]), [@field:EndDate]))) + " Day(s)"

Make sure to change the field names. I hope this works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...