开发者

how to write date in this format in c#

i have a date 9/27/2010 8:17:28 PM i want to开发者_JAVA技巧 write them in this format like 27 september 2010 8:19 PM how i can write in this format using c#


Use a custom DateTime format string:

string res = myDate.ToString("d MMMM yyyy h:mm tt", CultureInfo.InvariantCulture);

Update:

As @Jon Hanna mentions, this will format the month with title case (September), so if you want it exactly as in your example (september), you can add a ToLowerInvariant() method call.


Check Custom Date and Time Format Strings on msdn.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜