日期格式 [英] Date Formate
本文介绍了日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我需要一些帮助...如何从日期中获取(AM,PM),就像我们从DateTime.Now.GetDate()获取日期一样?
谢谢,
Hi All
i need some help...... how i can get the (AM,PM) from the date, as we get the date from DateTime.Now.GetDate()?
thank,,
推荐答案
您可以检查小时属性,如果它是> 12,则是PM
为什么要调用GetDate?
You can check the hour property, if it''s > 12, it''s PM
Why would you call GetDate ?
为什么不使用
DateTime.Now.ToString()
Why dont u use
DateTime.Now.ToString ()
我认为tt将放置AM/PM
例如:
DateTime.Now.ToString("MM/dd/yyyy hh:mm tt");
将会产生12/21/2009 02:30 PM
:)
I think tt will place AM/PM
For Example :
DateTime.Now.ToString("MM/dd/yyyy hh:mm tt");
will produce 12/21/2009 02:30 PM
:)
这篇关于日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文