日期格式,如2010年1月1日 [英] Date Format like 1st Jan 2010
本文介绍了日期格式,如2010年1月1日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
有人可以告诉我如何在vb.net和c#.net中以"2010年1月1日"或"2010年1月2日"这样的格式获取日期.
请标记我在询问超级脚本"st"或"nd".
任何帮助表示赞赏.
问候,
Snigdharani
Hi All,
Can somebody tell me how can i get the date in a format like "1st Jan 2010" or "2nd Jan 2010" in vb.net and c#.net.
Please mark I am asking about the super script "st" or "nd".
Any help is appreciated.
Regards,
Snigdharani
推荐答案
您可以尝试以下方法:
You could try this:
DateTime d = new DateTime(2010, 12, 21);
Console.WriteLine(d.ToString("d{0} MMM yyyy"), "<sup>st</sup>");
并编写一个函数来确定是否需要st/th/nd等
and write a function to decide if you want st/th/nd etc
这篇关于日期格式,如2010年1月1日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文