int month=DateTime.Now.Month;
It gives output as = 04
But how do I get the month as string 'April' from code behind?
int month=DateTime.Now.Month;
It gives output as = 04
But how do I get the month as string 'April' from code behind?
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
string month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month);
..if you want it in the right culture
@pranay, @gsharp: The DateTime.ToString(string format)
method respects the current culture.