Index | Next 

CDate, IsDate

VB.NET version of CDate and IsDate methods is less forgiving than the corresponding VB6 method. Under VB6 these methods attempt to reverse the day-month numbers if they don’t make up a valid date. For example, under VB6 both statements assign the #11/23/2008# date constant to the target variable:
        dat = CDate("11/23/2008")   ' dd/mm/yyyy format is assumed
        dat = CDate("23/11/2008")   ' mm/dd/yyyy format is assumed
Under VB.NET one of the two assignments fails. (Which assignment fails depends on locale settings.)

VB Migration Partner’s library contains two methods, named CDate6 and IsDate6, that mimics VB6 behavior and ensures that converted applications behave like the original ones.

 

Index | Next