The following code:
DateTime dt = new DateTime(2013, 9, 13, 14, 34, 0);
string s = dt.ToString("MM/dd/yyyy");
textBox1.AppendText(DateTime.Now + "\n");
textBox1.AppendText(s + "\n");
textBox1.AppendText(dt.ToString() + "\n");
produces the following output in the textbox:
13.09.2013 1441.28
09.13.2013
13.09.2013 1434.00
From the first line of the output, it is clear that in the regional setting of my PC, date/time is formatted as date.month.year HHmm.ss.
The second line of the output is confusing to me. Though I specified MM/dd/yyyy format for the variable s, the DateTime object is formatted as MM.dd.yyyy. Why?
This is a C# WPF program on .NET Framework 4.