I have a string like this:
"20090212"
and I want to convert to valid C# datetime.
Do I need to parse it out because that seems too much work?
You can use DateTime.ParseExact:
DateTime result =
DateTime.ParseExact("20090212", "yyyyMMdd", CultureInfo.InvariantCulture);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With