Is there a DateTimeFormatInfo format pattern to convert a day of week to two characters? For example Tuesday becomes Tu, Wednesday becomes We. The format string needs to conform to the DateTimeFormatInfo for date formats.
Addition:
Maybe I am looking for a solution to extend DateTimeFormatInfo to include custom formats?
You need to get the
DateTimeFormatInfoof the culture you're working with, then modify the array of strings calledAbbreviatedDayNames. After that,dddwill returnThfor you.http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.abbreviateddaynames(VS.71).aspx
Here's a sample of how to do it:
One more note: of course, if you are constrained from providing the
IFormatProvider, then you can override the current thread'sCultureInfo, for example:More on CurrentCulture:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx