从日期/时间字符串中删除时间 [英] Remove time from a date/time string
本文介绍了从日期/时间字符串中删除时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
这非常有用:
http:// www .csharp-examples.net / string-format-datetime /
在你的情况下,我会说:
DateTime dt = new DateTime(2008,3,9,16,5,7,123);
String.Format({0:MM / dd / yy},dt);
I have date and time stored in my database and I don't want to display both, just the date itself. When I store the date/time in a variable how do I output just the date in C#?
解决方案
This is very useful:
http://www.csharp-examples.net/string-format-datetime/
In you case I would say:
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
String.Format("{0:MM/dd/yy}", dt);
这篇关于从日期/时间字符串中删除时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文