开发者

Date formats in C#

I need to display dates in Month date,开发者_如何学C year (Ex: January 20, 2010).

Any suggestion ?


var dt = new DateTime(2010, 20, 1);
string s = dt.ToString("MMMM dd, yyyy");

See here for more info.


See this MSDN document. Contains all the information required for custom date and time format strings.

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

Probably worth bookmarking it as well, I always find myself coming back to it.


Use String.Format(formatspecifier)

Custom Numeric Format Strings


Try DateField.ToString("MMMM-dd-yyyy");

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜