Check date format...

lidds

Well-known member
Joined
Oct 19, 2004
Messages
122
Programming Experience
Beginner
I am currently writing an import utility for my application, that will import a .csv file into an SQL database. What I am currently doing is reading the csv file and carrying out various checks to ensure that certain fields have data etc.

I am however having problems checking the format of the date. Within the csv file the user could have mm/dd/yyyy e.g. 07/22/2007 or dd-mmm e.g. 07-Jul All I want to be able to do is check or convert the date into dd/mm/yyyy format.

Can anyone help? I have tried the following however even if the date is in dd/mm/yyyy format it still gives an error:

VB.NET:
                    Try
                        strCreated = strCreated.ToString("dd/MM/yyyy")
                    Catch
                        msgbox("wrong format")
                    End Try

Thanks in advance

Simon
 
Back
Top