When I call this code:
DateTime timeStamp = new DateTime();
timeStamp = File.GetLastWriteTime(openFileDialog.FileName);
I get a DateTime in this format:
28.12.2020 21:17:29
But when I save it in a config:
Properties.Settings.Default.TimeStamp = timeStamp;
Properties.Settings.Default.Save();
It will be saved with slashes instead of dots and month and date swapped:
06/20/2020 11:44:28
When I want to compare them afterwards they dont match. (I know that these two excamples dont match, but the layout is completly different too). How can i fix it that they will be saved with the same layout.
question from:https://stackoverflow.com/questions/65945370/datetime-gets-saved-in-a-wrong-layout