Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/104973

From BetaArchive Wiki

Article ID: 104973

Article Last Modified on 5/6/2003


  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition

This article was previously published under Q104973

Moderate: Requires basic macro, coding, and interoperability skills.


When you use the DateDiff() function on a large interval where the time periods are specified in minutes or seconds, the result is not correct.


The DateDiff() function returns a long integer. If the result is greater than the allowed range for long integers (-2,147,483,648 to 2,147,483,647), Microsoft Access truncates the value and returns the truncated value.


Steps to Reproduce Behavior

  1. Create a new module. Enter the following in the module's Debug window (or Immediate window in versions 1.x and 2.0), and then press ENTER:

     ? DateDiff("n",#12-31-100#,#12-31-9999#)

    Note that the returned value, 911,403,103 minutes, is truncated because the actual value exceeds 2,147,483,647.
  2. Enter the following calculation, which is equivalent to the function above, and then press ENTER:

          ? (y-x)*24*60

    Note that the returned value, 5,206,370,400 minutes, is correct. Note that Microsoft Access uses double-precision real numbers when doing immediate calculations.

Additional query words: date

Keywords: kbprb kbusage KB104973