I’m trying to parse a DateTime from EDI-Order ( “20120713” / YYYYMMDD or “120713” / YYMMDD or even other dates WITHOUT dots, so just numbers ) to a valied Date like “DD.MM.YYY” in C#.
I have no idea how many diferent date-formats are in the diferent EDI-Orders, so i’m searching for a solution i can apply to all of them.
thanks everybody.
You should be interested in using this overload of
ParseExact, you can pass in multiple formats as an array and it will attempt to parse it based on them.(it would be good if you can control the formats and intend on using one for the process)For your output you can do
start.ToString("dd.MM.yyyy")