views:

99

answers:

3
int month=DateTime.Now.Month;

It gives output as = 04

But how do I get the month as string 'April' from code behind?

+2  A: 
string month = DateTime.Now.ToString("MMMM");

For additional hints how to use ToString to get another results, this may help: http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

Mendy
+2  A: 
string month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month);

..if you want it in the right culture

gsharp
+2  A: 

@pranay, @gsharp: The DateTime.ToString(string format) method respects the current culture.

JT