I am working on changing these strings into this format yyyy-mm-ddhh:mm:ss
I put the strings into an array, fed it into a four each loop where I am using the Insert() function to add the "-" and ":" in the appropriate positions but it is still printing out the original strings.
static void Main(string[] args)
{
string[] dates = { "20190127144251", "20190127123315", "20190127035942" };
foreach (string i in dates)
{
string str = i;
str.Insert(3, "-");
str.Insert(5, "-");
str.Insert(7, "-");
str.Insert(9, ":");
str.Insert(11, ":");
Console.WriteLine(i);
}
}
}
Printing out the original string, not formatted