Article ID: 152781
Article Last Modified on 11/21/2006
enum DateTimeStatus
{
valid = 0,
invalid = 1, // Invalid date (out of range, etc.)
null = 2, // Literally has no value
};
The problem occurs because SetDate, SetTime, and SetDateTime all return
'valid' if successful. However 'valid' is defined to be 0 in the
DateTimeStatus enumeration, which translates to a Boolean FALSE. The code
should check for success and return TRUE or FALSE.
COleDateTime myodt; VERIFY(myodt.SetDateTime(96,1,1,10,45,0));To work around this problem, test the success of the call by calling the COleDateTime::GetStatus() member. Compare the value returned by GetStatus() against 'valid' to check for success as shown in this example:
COleDateTime myodt;
myodt.SetDateTime(95,6,1,23,45,0);
VERIFY(myodt.GetStatus() == COleDateTime.valid);
Additional query words: kbVC400bug
Keywords: kbbug kbfix kbnoupdate kbvc420fix KB152781