<p>I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" rel="nofollow noreferrer">docs</a>, 'd' should produce the day (1-31).</p>

<pre><code>string.Format("{0:d }", DateTime.Today);
string.Format("{0:d}", DateTime.Today);
</code></pre>

<p>UPDATE:Adding % is indeed the trick. Appropriate docs <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers" rel="nofollow noreferrer">here</a>.</p>

See
here
d, %d
The day of the month. Single-digit days do not have a leading zero. The application specifies "%d" if the format pattern is not combined with other format patterns.
Otherwise d is interpreted as:
d - 'ShortDatePattern'
PS. For messing around with format strings, using
LinqPad
is invaluable.