When I have a DateTime value with 500 milliseconds or more, I would expect the ToString method to round to the nearest second (if the current culture is showing seconds, which en-US does). However, it instead seems to truncate the millisecond value
For example, the code below outputs this: 10/1/2010 8:22:33 AM, when I expect it to output this: 10/1/2010 8:22:34 AM.
var d = new DateTime(2010, 10, 1, 8, 22, 33, 777);
string date = d.ToString(new CultureInfo("en-US"));
MessageBox.Show(date);
Note I am aware that I can give a custom format string to ToString, but I don't want to do this because I will actually be passing the current culture to ToString and not always passing the en-US
I am trying to reconcile values with an existing system (Excel) that does round the values. On a machine with US locale, if you paste 2010/10/1 8:22:33.777 in a cell with General number format and then click the cell, the formula bar in excel will show you 10/1/2010 8:22:34 AM