-2

I need to convert this string to DateTime: "10/1/19 4:19:38 AM UTC"

I have tried the below and get various errors.

CultureInfo provider = CultureInfo.InvariantCulture;
DateTime.ParseExact(value.ToString(), "MM/dd/yy hh:mm:ss tt KKK", provider);
DateTime.ParseExact(value.ToString(), "MM/dd/yy hh:mm:ss t K", provider)

this is different from Parse DateTime with time zone of form PST/CEST/UTC/etc as it is parsing an alpha month name

Tim Bassett
  • 1,325
  • 1
  • 12
  • 23

1 Answers1

1

"UTC" is something that can't be parsed. You should use e.g. "+02:00" as a time zone indicator.

Remove the "UTC" from the end, after that go with this format:

"M/d/yy h:m:s tt".

Or change "UTC" to "+02:00" and use this format:

"M/d/yy h:m:s tt K"
Mitulát báti
  • 2,086
  • 5
  • 23
  • 37