简体   繁体   中英

Convert a DateTime to String representing the date

How can I convert a DateTime to a String ?

For instance, I want to convert a DateTime representing:

11/30/2012 

to

November Thirtieth Two Thousand Twelve

我的朋友,你的 google-fu 很弱,但你会学到: http ://www.c-sharpcorner.com/UploadFile/b942f9/converting-dates-to-words-in-C-Sharp/ :)

No luck here, but a partial relief:

String.Format("{0:dddd, MMMM d, yyyy}", dt); // "Sunday, March 9, 2008" Source

The Day and Year string you will have to do the long way. Day-of-Week and Month are available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM