To get the Month name of a Datetime in C# and VB.NET you can use the following snippet.

Sample C#

Console.WriteLine(new DateTime(2010, 1, 1).ToString("MMM", CultureInfo.InvariantCulture)); //Jan
Console.WriteLine(new DateTime(2010, 1, 1).ToString("MMMM", CultureInfo.InvariantCulture)); //January

Sample VB.NET

Console.WriteLine(New DateTime(2010, 1, 1).ToString("MMM", CultureInfo.InvariantCulture))
'Jan
Console.WriteLine(New DateTime(2010, 1, 1).ToString("MMMM", CultureInfo.InvariantCulture))
'January

3 thought on “How to get the Month name of a Datetime in C# and VB.NET”

Leave a Reply