As the title says, I want to convert a date string, for example.
"6/6/2014 12:24:30 PM" (M/d/yyyy h:mm:ss tt) format
to
"YYYY-MM-DDThh:mm:ss.SSSZ".
I am trying to do the following. This gives me no exceptions, but I get the value as:
"YYYY-06-DDT12:24:30.SSSZ"
How can I achieve this?
string LastSyncDateTime = "6/6/2014 12:24:30 PM";
DateTime dt = DateTime.ParseExact(LastSyncDateTime, "M/d/yyyy h:mm:ss tt",CultureInfo.InvariantCulture);
string result = dt.ToString("YYYY-MM-DDThh:mm:ss.SSSZ");
source
share