tags:

views:

73

answers:

3

Consider:

Assert.Equal("11 Aug 2010", date.ToString(???);

Somehow ToString("d MMM yyyy") outputs "11 aug 2010". How can I make it to be Aug instead of aug?

+4  A: 

ToString("d MMM yyyy", CultureInfo.CreateSpecificCulture("en-US")

works

Arnis L.
A: 

In that case how about using ToTitleCase():

ToTitleCase() method is hidden treasure of .Net Framework hosted by the System.Globalization.TextInfo namespace and can be used as shown below:

string sentence = "this is a title case EXAMPLE sentence";
string formattedSentence = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(sentence.ToLower());

Will result in "This Is A Title Case Example Sentence"

Xander
That `Assert` was just to show what i need. Funky style to format questions on stackoverflow. In application I'm developing - I'm just outputing it. Don't need to compare anything.
Arnis L.
I have updated the code show ToTitleCase() method, in case you don't find anything suitable for your Date Formatting.
Xander
A: 

I have this cheat sheet website that i have saved to my favourites

http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

Iain