Search code examples
c#date-format

c# First monthletter in uppercase


I'm displaying a month name like this:

String.Format("{0:MMMM}", DateTime.Now) 

However, when using Swedish all month names are in lowercase.

Is there some neat trick to make first letter uppercase when formatting dates? Or do I have to write a function for it?


Solution

  • There are some good answers here already. If you want a function you can write:

    char.ToUpper(s[0]) + s.Substring(1);