The information in this article applies to:
SYMPTOMSThe VarDateFromStr function may return without an error when a seemingly invalid date is passed. Furthermore, the VarDateFromStr function may return without error, regardless of what the locale is set to. CAUSEIn VarDateFromStr, the code does not strictly check the string passed against the date format of the default system locale, default user locale, or the locale passed to the function. The function returns without error if the passed string is valid in any of the following date formats:
RESOLUTIONIf you need to verify that the date is valid based on the specific date format for a locale, do not depend on the VarDateFromStr function. This implies that any code relying on the MFC function COleDateTime::ParseDateTime to do strict checking should be changed also because this MFC function uses VarDateFromStr internally. Microsoft recommends that you check the string first in your code before calling VarDateFromStr or COleDateTime::ParseDateTime to make sure it is a correct date for the date format of the locale. STATUSThis behavior is by design. MORE INFORMATIONWhen calling VarDateFromStr, even under the English (United States) locale, you can pass a date such as "29-2-01". This is evaluated to Jan 2, 2029, and VarDateFromStr will not return an error. Additional query words: date parsing comparision conversion COleDateTime ParseDateTime
Keywords : kbNTOS400 kbWinOS95 kbWinOS98 kbDSupport kbGrpMFCATL |
Last Reviewed: October 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |