Jump to content
  • 0

datediff variance


bookish

Question

Hi! I would like my report to show the difference between the start date of an activity and the birthday of a participant. It seems that datediff does not work as per my studies. Say the activity starts on Jan 1 and the birth day is Jan 3, I would like the column to show, 0 (for the month), 2 (for the days). Is this possible in Caspio?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hey there,

I believe you have a similar function like this inquiry.

On 1/2/2019 at 10:44 AM, Scarlet said:

Hi @roattw

I have the same workflow but I somehow found a workaround for this.

 

I created 3 Virtual fields, one for Year calculation, one for month, and another one for year. 

Inside the virtual fields, here are my formula.

For Year:

Datediff(mm, [@field:Birthdate], GetUTCDate())/12

For Month:

Datediff(day, [@field:Birthdate], GetUTCDate())/30 - ([@cbParamVirtual1]*12)

For Day:

Datediff(day, [@field:Birthdate], GetUTCDate()) - ([@cbParamVirtual1]*365) - ([@cbParamVirtual2]*30)

 

And then I concatenated them all to the field that is on my table:

CONVERT(VARCHAR, [@cbParamVirtual1]) + "YEARS " + 
CONVERT(VARCHAR, [@cbParamVirtual2]) + "MONTHS " + 
CONVERT(VARCHAR,[@cbParamVirtual3]) + "DAYS"

 

This was my output.

Screenshot_2.png.ff8ca42d7fbfa6a71fe62fa442c0137a.png

 

I also hid the Virtual fields using HTML Block so it won't show on the DataPage.

 

Hope this helps!

 

Click this LINK to see the forum conversation.

 

Hope this helps!

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.

Guest
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.

Loading...
×
×
  • Create New...