Friday, August 28, 2009

Convert string to DateTime

Convert string to DateTime

This code snippet shows how to convert a string to a DateTime object. This method returns false if the string cannot be converted to a valid date in the specific format.

You can specify more formats in the variable "supportedFormats".

Eg:
dim myDate as DateTime = DateTime.Now
if ( ConvertToDate("12/10/2007", myDate ) then
' The date is valid. The variable myDate has the converted date.
end if



View Full Details...............................

No comments:

Post a Comment