VB Script CDate() Function - TestingQ.com

-->Exclusive Portal for Testing Jobs

VB Script CDate() Function


CDate() - Convert to Date Value
The CDate function converts a valid date and time expression to type Date, and returns the result.

Example:
a = "March 15,2011"
msgbox typename(a)           'Output --> String
msgbox a                             'Output --> March 15,2011

b = Cdate(a)

Msgbox typename(b)            'Output --> Date
msgbox b                              'Output --> 3/15/2011

Note: Use the IsDate function to determine if date can be converted to a date or time.  The IsDate function uses local setting to determine if a string can be converted to a date ("January" is not a month in all languages.)