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.'
Asked
Active
Viewed 55 times
-1

Kok How Teh
- 3,298
- 6
- 47
- 85
-
1There is no such datetime value. – Cetin Basoz Oct 27 '22 at 09:47
-
1What date should this be: 2022003023 ? – Tim Schmelter Oct 27 '22 at 09:47
-
1also MMMM is **full name** of the month[...](https://dotnetfiddle.net/kEGnux) – Selvin Oct 27 '22 at 09:48
1 Answers
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