This is small code. But I couldn’t find whats wrong with it. In my application I want to get the current month in long month format(ex:January). I used the following two lines of code.
DateTime now = DateTime.Now;
string month = now.Month.ToString("MMMM",CultureInfo.CurrentCulture);
but its return “MMMM” for the values of month. Can anybody tell me whats wrong in this code.
now.Month is the
intrepresentation the month e.g. 1 for January, that’s why the.ToString("MMMM")works “strange”.What you need is to call the
.ToString()directly on theDateTimeobject: