Days between date and now

Hi everyone,

I cannot seem to work out how to calculate the number of days between a date and the current date.
If I am doing it correctly it is coming back as a duration. Can this be converted in a simple integer number of days?

Solved Solved
0 5 2,566
1 ACCEPTED SOLUTION

Hi @SKETCHwade ,

Could you please elaborate what expression and column types you are using and what result you are getting ?

Typically , we get number of days between two dates by using an expression something like HOUR([End Date]- [Start Date])/24

View solution in original post

5 REPLIES 5

Hi @SKETCHwade ,

Could you please elaborate what expression and column types you are using and what result you are getting ?

Typically , we get number of days between two dates by using an expression something like HOUR([End Date]- [Start Date])/24

Thanks for this interesting solution, @Suvrutt_Gurjar! When I first saw the answer, I became concerned that the time that the date was recorded might affect the result. Now I see, though, that as long as you make sure your are dealing with just dates and not dates and times, it works perfectly. For example, the following yields the number 1, as it should, even though only an hour has elapsed:

hour(DATE(โ€œ12/12/2019 00:30:00โ€)-DATE(โ€œ12/11/2019 23:30:00โ€))/24

Counting weekdays or workdays is more complicate but @LeventK has already written about that:

H @Kirk_Masden,

Thank you for useful reference. @LeventK 's solutions are always interesting and educating.

In this case, it is not exactly specifically my solution, the approach is already documented in the following AppSheet article. At the most, I may say I just remember it after having used it a few times.

Please look at the first example in section
## โ€œExamples that Compute Durations in Days, Months, or Yearsโ€ in the article below

Hello everyone. I am posting my question here because I is the same question and I thought it was better than starting a new thread with the same topic. Please let me know if I should have created a new one!
I have an app where I was able to do the above where I have a start and an end time stamps and a virtual column calculates the duration of time between them. But I now have an app where I am using child forms for recurrent questions. That child form has a time stamp question and I would like to create a virtual column on the parent form that calculates the hours or days between the first and last โ€œlinesโ€.
I am struggling with that formula a bit for a few reasons:

1 - I need that to be calculated only with lines/entries that share the same answer on a Ref column.
2 - Sometimes the timeframe I need to be calculated will have 2 lines/entries, but sometimes 3 or 4 or whatever.

Thank you!

If you want to do that on a parent record, then it would be something like MAX([Related Timesheet][Timestamp])-MIN([Related Timesheet][Timestamp])

Top Labels in this Space