For the following code, I would expect result to equal 2, because the MSDN states that \'d\' \"Represents the day of the month as a number from 1 through 31. A sing
To indicate that this is a custom format specifier (in contrast to a standard format specifier), it must be two characters long. This can be accomplished by adding a space (which will show up in the output), or by including a percent sign before the single letter, like this:
string result = myDate.ToString("%d");
See documentation