DateTime temp = DateTime.Parse("7/30/2010 11:05:53 AM");
string converted = temp.ToString("dd/MM/yyyy");
- Использование Try Parse ---
// Try Parse is better because if the format is invalid an exception is not thrown.
DateTime temp;
string converted = string.Empty;
if (DateTime.TryParse("7/30/2010 11:05:53 AM", out temp))
{
// True means Date was converted properly
converted = temp.ToString("dd/MM/yyyy");
}
else
{
converted = "ERROR in PARSING";
}