DateTime's formatting has some overlap between it'a standard date and time formatting strings and some of it's custom format specifier by them selves. As a result, when I evalate this expression:
string.Format(">{0:d}< >{0: d}<", DateTime.Now)
and get this result:
>8/3/2009< > 3<
My question is: How do I get String.Format to output just the day of the month (using the d
format) without any surrounding spaces?
use "{0:%d}
": reference
I keep this page in my favorites...
http://blog.stevex.net/index.php/string-formatting-in-csharp/
Saves me all the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With