I have a string in the following format yyyyMMdd and I am trying to get it to look like this:
yyyyMMdd
yyyy-MM-dd
When I try:
It's a little ugly, but how about this?
date.Insert(6, "-").Insert(4, "-");
If you can assume you're coming in with a string representing a valid date and you don't need to do any other date-ish logic, then why go to a DateTime in the first place?
DateTime