DateTime格式在C#格式、DateTime

2023-09-04 04:31:21 作者:白首同倦

可能重复:   在C#中 格式日期

我要的格式显示日期 2011年5月16日。我已经使用格式为:的String.Format({0:D}由我得到了像周一,2011年5月16日。 所以,请任何一个可以告诉我,我怎么就能够显示日期和时间按以下格式 2011年5月16日 在此先感谢

解决方案

 {0:MMMM研发,YYYY}
 

下面是文档。

自定义日期和时间格式字符串

C 里datetime的参数格式

Possible Duplicate: Format date in C#

I want to display the date in the formatMay 16, 2011. I have used format String.Format("{0:D}" by which i got the output like Monday, May 16, 2011 . So please any one tell me how i will be able to show date time in the following formatMay 16, 2011 Thanks in advance

解决方案

"{0:MMMM d, yyyy}"

Here is the documentation.

Custom Date and Time Format Strings

 
精彩推荐
图片推荐