日期VS日期时间 [英] Date vs DateTime

查看:279
本文介绍了日期VS日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于日期VS日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆