格式化日期时间 [英] Format Datetime to Date
本文介绍了格式化日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
How to convert this?
public DateTime Date { get; set; }
I need to display only date.
Please could any one help to convert this to Date only
推荐答案
在C#中,您没有Date类型,只有DateTime。您可以使用字符串格式仅显示日期。
自定义日期和时间格式字符串 [ ^ ]
In C# you don't have Date type, only DateTime. You can use string format to show the date only.
Custom Date and Time Format Strings[^]
Datetime date=Datetimne.parse(Datetime.now.tostring());
label.text=date.ToShortDateString();
这篇关于格式化日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文