How can i format/convert the date "20200415" to 2020-04-15? string date = "20200415";
the output should 2020-04-15
How can i format/convert the date "20200415" to 2020-04-15? string date = "20200415";
the output should 2020-04-15
I wouldn't make string manipulation - my approach with parsing the date with a formated output in a second step:
string date = "20200415";
DateTime dtTemp = DateTime.ParseExact(date, "yyyyMMdd", null);
string result = dtTemp.ToString("yyyy-MM-dd");