Bug in VBA function DateDiff

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,355
This is about the VBA function DateDiff, not the worksheet function DATEDIF.

I've recently found that DateDiff("d", "1/7/1900", "1/8/1900") returns 0 instead of the expected 1.
And there are 3 other dates that have a 0 DateDiff from the next day, 5/6/1900, 6/4/1922, 9/16/1989

This bug also effects the results of date ranges than include those dates.
Is this a known bug?

Thank you for reading.
 
According to MS, it is not related to the 1900-1904 Date Systems, and since Mike is able to use the year 1900, it's indeed using 1900 Date system, otherwise he would get a numeric error.

Date Systems
Date Systems 2
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
According to MS, it is not related to the 1900-1904 Date Systems, and since Mike is able to use the year 1900, it's indeed using 1900 Date system, otherwise he would get a numeric error.

Date Systems
Date Systems 2
Another reason it cannot be related to the 1900-1904 Date Systems is because Mike is doing this in VBA... there is only one date system there and it is not bound by 1900 or 1904 (those are Excel worksheet systems). It would seem like this is a bug in the Mac version of VBA's DateDiff function.
 
Upvote 0
That difference has been changed for the last couple of versions of Mac Excel. My version of Excel uses 1900 dates by default.
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top