[Solved] Convert string 2020-05-14T13:37:49.000+0000 to DateTime using format


You should use K format specifier, since it represents timezone offset

string format = "yyyy-MM-ddTHH:mm:ss.FFFK";

or zzz, which means signed timezone offset

string format = "yyyy-MM-ddTHH:mm:ss.FFFzzz";

You also might change DateTimeStyles to AdjustToUniversal to get 5/14/2020 1:37:49 PM date, otherwise it’ll be adjusted to local time

DateTime d;
DateTime.TryParseExact(f, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out d);

0

solved Convert string 2020-05-14T13:37:49.000+0000 to DateTime using format