Convert dd/mm/yyyy to DateTime format

This resource explains as how to convert the dd/mm/yyyy dates to DateTime format. Many would have experienced the "String was not recognized as a valid DateTime" error. This is to overcome this error.

When you try to convert the Dates which are in dd/mm/yyyy format to DateTime , the Date will be recognised by default as mm/dd/yyyy format and you will get exception as "String was not recognized as a valid DateTime.". You will recognise this error only when your date is greater than 12 and if you give for eg:"14/04/2010" you will get the error. Once your date is greater than 12, since the system by default recognises it as month it will throw the exception.

To overcome this error , when your date is is "dd/mm/yyyy" format from database or from the UI then you can use the below code technique