The following code works.
The convert to Double (commented out) does not work.
string temp = "01-01-2013 00:00:00";
DateTime d = DateTime.Parse(temp.ToString());
string convT = d.ToString("dd/MM/yyyy");
convT = convT.Replace("-", "/");
Console.WriteLine(convT);
The output is:
01/01/2013
Also, the line
convT = convT.Replace("-", "/");
does not do anything. It's attempting to replace - with / and there are no dashes in the string.
Maybe you meant:
string temp = "01-01-2013 00:00:00";
DateTime d = DateTime.Parse(temp.ToString());
string convT = d.ToString("dd/MM/yyyy");
Console.WriteLine(convT);
convT = convT.Replace("/", "-");
Console.WriteLine(convT);
Output is:
01/01/2013
01-01-2013
If Parse is throwing an exception, it is likely that the string is not in any of numerous formats that Parse can deal with.