How to check whether a string date can be converted to a DateTime or not?

GlorieBox

New Member
There is a SQL Server 2008 database for which I have to create a management software. The database contains a column named DateOfCreation. The table designer made this column as string and gave freedom to users to add date in any format they want and this was really a silly mistake by him. Now some users added as "24 Jan" or"Jan 24" or "1991 1 12" and many unknown formats. What I want is that when I fetch this string date, a function should be called that will check the format and return -1 if date is not in correct format else return the converted date in DD/MM/YYYY. So how can I check the format of the date that string date variable is containing?
 
Back
Top