开发者

how to write date in this format in c#

开发者 https://www.devze.com 2023-01-19 14:06 出处:网络
i have a date9/27/2010 8:17:28 PMi 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:

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

精彩评论

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