日期VS日期时间日期、时间、VS

2023-09-02 11:51:45 作者:此生再无相见时

我工作的一个程序,需要一个事件的日期得到恢复。我要寻找一个日期,而不是日期时间。必须有一个数据类型,它只是返回的日期......是吗?

I am working on a program that requires the date of an event to get returned. I am looking for a "Date", not a "DateTime". There has to be a datatype that returns just the date... is there?

推荐答案

没有没有。 的DateTime 重presents某个时间点,它由一个日期和时间。但是,您可以通过 日期 财产(这是另一个的DateTime 设置为时间 0点00分00秒 )。

No there isn't. DateTime represents some point in time that is composed of a date and a time. However, you can retrieve the date part via the Date property (which is another DateTime with the time set to 00:00:00).

您还可以通过 日 ,

And you can retrieve individual date properties via Day, Month and Year.