Microsoft KB Archive/937464

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

Article ID: 937464

Article Last Modified on 8/16/2007

-

APPLIES TO


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

-



SYMPTOMS
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 &quot;December 30, 1899.&quot; Additionally, you receive an assertion failure message.



CAUSE
This issue occurs because the date value &quot;December 30, 1899&quot; 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.



WORKAROUND
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.

