I need to convert date format from string to dd/MM/yyyy tt:mm:ss
in C# for example convert
string = "2015-07-21T23:00:00.000Z"
to
{21/07/2015 00:00:00}
I need to convert date format from string to dd/MM/yyyy tt:mm:ss
in C# for example convert
string = "2015-07-21T23:00:00.000Z"
to
{21/07/2015 00:00:00}
I would parse it to DateTime
with DateTimeStyles.RoundtripKind
enumeration since it is ISO 8601 format then use it's Date
property to set it's time part to midnight.
var dt = DateTime.Parse("2015-07-21T23:00:00.000Z", null, DateTimeStyles.RoundtripKind);
Console.WriteLine(dt.Date.ToString("dd'/'MM'/'yyyy HH:mm:ss")); // 21/07/2015 00:00:00
Here a demonstration
.