开发者

Convert DateTime.Now.Month; as string value

int month=DateTime.Now.Month;

It gives output as = 04

But how do I get the 开发者_如何学JAVAmonth 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜