You have 2 options to use your ...GMT
part as string literal delimiter in custom date and format string:
But I suggest to use single quotes because if you use double quotes, you need to escape your quotes with \
(because of escape sequence) or you can use verbatim string literal.
Do the same thing with T
middle in your string as well.
Also use HH
specifier which is for 24-hour clock and use s
speficier instead of ss
because you have 5
digit after your T
that's why it doesn't accept HHmmss
format.
The reason of you get G3T
it is because M
is has meaning of month of custom string format and that's why your GMT
parsed as G3T
.
string s = "19900321T20000.000G3T";
var dt = DateTime.ParseExact(s, "yyyyMMdd'T'HHmms'.000G3T'",
CultureInfo.InvariantCulture);
With double quotes;
string s = "19900321T20000.000G3T";
var dt = DateTime.ParseExact(s, "yyyyMMdd\"T\"HHmms\".000G3T\"",
CultureInfo.InvariantCulture);