The "RFX_Date" function returns a value of "December 30, 1899" when you run the function on a date/time data type field in a Visual C++ .NET Framework application

This article has been archived. It is offered "as is" and will no longer be updated.
Consider the following scenario. In a Microsoft Visual C++ .NET Framework application, you call the RFX_Date function on a date/time data type field. The field is stored as having a short date/time format in a Microsoft Office Access database. In this scenario, the function returns a value of "December 30, 1899." Additionally, you receive an assertion failure message.
This issue occurs because the date value "December 30, 1899" is out of the range of CTime object dates.

Access stores date/time data type fields as floating-point numbers. The date is represented in the decimal part, and the time is represented in the fractional part. The ranges of date/time data type values in Access are as follows:
  • The date range is from -647,434 (January 1, A.D. 100) to 2,958,465 (December 31, A.D. 9999).
  • The time range is from 0 (00:00:00) to .99999 (23:59:59).
The range of CTime object dates is from 1/1/1970 12:00:00 A.M. to 12/31/3000 11:59:59 P.M. When you insert only the hour and do not include a specific date in an Access database, 0 (zero) is inserted in the date/time data type field. (This behavior is by design in Access.) The fractional part is interpreted as December 30, 1899.
To work around this issue, use one of the following methods:
  • Use the TIMESTAMP_STRUCT data type and the appropriate RFX_Date function to load hours.
  • Use the CTime object. However, make sure that records of the database contain only valid values for the CTime object.
  • In the database, use the General Date date/time data type instead of the Short time date/time data type.
For more information about the RFX_Date function, visit the following Microsoft Developer Network (MSDN) Web site: For more information about this function, click the following article number to view the article in the Microsoft Knowledge Base:
114961 RFX_Date function for TIMESTAMP_STRUCT

Article ID: 937464 - Last Review: 01/15/2015 09:36:10 - Revision: 1.0

Microsoft Visual Studio 2005 Standard Edition, Microsoft Visual Studio 2005 Professional Edition, Microsoft Visual Studio 2005 Express Edition

  • kbnosurvey kbarchive kbtshoot kbprb KB937464