Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Substracting dates

Featured Replies

Hi

I would like to substrack two dates and get the result in number. Something like 04/01/2006 - 01/01/2006 = 4

Thanks

Hi

the two dates are into two date fields ?

If so, the calc is: date2 - date1 + 1

or, if you don't know wich is the greatest:

Abs(date2 - date1) + 1

  • Author

I try to substract the current day which is a calc and a date field. I end up with a weird result.

Your current day calc ( = Get ( CurrentDate ) ) must be UNSTORED

Hi

I would like to substrack two dates and get the result in number. Something like 04/01/2006 - 01/01/2006 = 4

Thanks

Well, you can create a calculation field whose result is a Number and basically use the equation you wrote. Assuming the dates are in two fields it would be as simple as:

Date2 - Date1

However, this will return the number of days not the number of months as it appears that you are looking for. You could then try:

Truncate((date2 - date1)/30,0)

This basically takes the number of days between the two dates and divides it by an estimated number of days per month. Then, the Truncate function just drops the numbers to the right of the decimel. You could leave the Truncate function of if you want the exact number of months.

It should be noted though that using the above calculation using the two dates that you used in your post would not return 4. It would return 3.

  • Author

it is...

I think that Bikerman17 is using the format:

DDMMYYYY (international)

Isn't so, Bikerman ?

I think that Bikerman17 is using the format:

DDMMYYYY (international)

Isn't so, Bikerman ?

That would explain it. Sorry. I was looking at it from a U.S. perspective. Either way though, you would have add 1 to the result like Daniele did in an earlier post.

I try to substract the current day which is a calc and a date field. I end up with a weird result.

Please, give us an example of those "weird result"

  • Author

Yes I am using the internationnal format but it doesn't matter. I got -86.

Please, check your fields definitions...

date1 must be a date

date2 must be a calc (result date) = GetCurrentDate

Difference must be a calculation (result number)

  • Author

Perhaps I am missing something, attach a sample to your next reply. I'd like to see that in detail.

Here it is !

P.S. I have added some "case" statement, so if the date is empty, the calc don't evaluate.

DateDifference.zip

  • Author

Basically, that's what I did but in my file the result is 87. I pasted your calc and got the same result. My date format is DDMMYYYY but I never encountered any limitations in dealing with date string calculations. Anyway I manage to use your file in relationship with another one.

Thank you

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.