Forum Discussion
DATEDIF FUNCTION
1) DATEDIF is a weird function. For many years, it wasn't officially documented by Microsoft. It is now, but with a warning that the result is not always accurate: DATEDIF function
2) Date calculations involving the last days of a month are always problematic:
It's reasonable to say that from February 20, 2023 to March 20, 2023 is exactly 1 month, since both dates are on the same day of the month.
And from February 20, 2023 to March 21, 2023 is 1 month and 1 day.
Following the same reasoning, from February 28, 2023 to March 28, 2023 is 1 month.
From February 28, 2023 to March 29, 2023 is one day more, so 1 month and 1 day.
From February 28, 2023 to March 30, 2023 is 1 month and 2 days.
From February 28, 2023 to March 31, 2023 is 1 month and 3 days.
But February 28 and March 31 are both the last day of their month, so it is also reasonable to say that it is exactly 1 month and 0 days.
There is no one single solution that will satisfy everybody...
- Koi16Feb 04, 2023Copper ContributorThanks for your reply!