asp.net中的日期格式 [英] Date format in asp.net
本文介绍了asp.net中的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将日期转换成年和月的格式,请帮助
我使用了DateTime.Now.ToString("y")和DateTime.Now.ToString("m"),但无法正常工作.
请咨询
i would like to convert date to year and month format, please help
i used DateTime.Now.ToString("y") and DateTime.Now.ToString("m") but its not working.
please advice
推荐答案
您好,
请通过以下链接,希望它们对您有所帮助:
http://www.dotnetperls.com/datetime-format [轻松将字符串转换为DateTime,将DateTime转换为字符串和格式 [ ^ ]
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx [ ^ ]
Hello,
Please go through following links, hope they help you:
http://www.dotnetperls.com/datetime-format[^]
Easy String to DateTime, DateTime to String and Formatting[^]
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^]
尝试:
String s = DateTime.Now.ToString("MMM yyyy");
此处有格式列表: ^ ]
请注意,这些转换是特定于区域性的,因此,如果您在服务器上运行此转换,则不一定会在客户端上产生本地日期.
There is a list of the formats here: Formatting a DateTime for display - format string description[^]
Do note that these conversions are culture specific, so if you run this on a server it will not necessarily produce a local date on a client.
^ ]
这篇关于asp.net中的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文