Well your input string is
12/12/2015 12:00:00 AM
and your parse expression is
dd/MM/yyyy
so your expression doesn't match the input string.
Try this expression instead:
dd/MM/yyyy hh:mm:ss tt
[UPDATE]
DateTime does not have a specific format, it is kind of a placeholder for a date and time.
Only when you decide to present the date to a user, in e.g. a text box, will you give it a format.
For this you can use the methods:
- ToLongDateString()
- ToLongTimeString()
- ToShortDateString()
- ToShortTimeString()
- ToString()
ToString() will give you the most control of the format and you can avoid culture variations of the date on different computers, unless that is desired.
See
Custom Date and Time Format Strings[
^]
For your desired format it would be
DateTime dt = DateTime.Now;
string s = dt.ToString("dd/MM/yyyy");
So please forget about storing a date in a specific format.
The only way to do that is to store it as a string, and that would not be the smartest of things.