-1

I tried DateTimeOffset dto = DateTime.ParseExact("2022003023T05:57:44.200Z", "yyyyMMMMdd'T'HH':'mm':'ss'.'fff'Z'", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); but to no avail: 'String '2022003023T05:57:44.200Z' was not recognized as a valid DateTime.'

Kok How Teh
  • 3,298
  • 6
  • 47
  • 85

1 Answers1

0

(Would be a mess as a comment) If those extra 0's were typos for separators (2022/03/23T05:57:44.200Z being the real value), then:

void Main()
{
    string s = "2022003023T05:57:44.200Z";
    var ss = s.ToCharArray();
    ss[4] = '/';
    ss[7] = '/';
    var dt = new string(ss); 
    DateTimeOffset dto = DateTime.Parse(dt);
    Console.WriteLine(dto);
}
Cetin Basoz
  • 22,495
  • 3
  • 31
  • 39