没有时间的.NET日期 - 有没有一个,或者我不需要一个? [英] .NET Date without Time - is there one, or should I not need one?

查看:117
本文介绍了没有时间的.NET日期 - 有没有一个,或者我不需要一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些域名建模,并且遇到一个属性,在我看来,这个属性最好以Date为日期而不是DateTime,而没有时间组件。

I'm doing some domain modelling and coming across a property which to my mind would be best exposed as a Date rather than a DateTime, without a time component.

有没有一个很好的理由为什么在框架中没有这样的类型?将日期类型添加到SQL Server被认为是一个很好的想法。另外,如果有人知道Date类的方便实现,请让我知道!

Is there a good reason why there is no such type in the Framework? It was deemed a good enough idea to add a Date type to SQL Server. Also, if someone knows of a handy implementation of a Date class, please let me know!

推荐答案

不,没有一个,是的,应该是。

No, there isn't one, and yes, there should be.

我不相信有一个很好的理由,除了 .NET中的日期和时间API在我的(非常有偏见的)视图中不是很好。

I don't believe there's a good reason other than that the date and time API in .NET isn't very good in my (very biased) view.

我正在开发一个名为 Noda Time 当然 在( LocalDate )中只有一个date-only类,但尚未准备好生产。它可能已经完成了您所需要的一切,当然,如果它几乎,那么您可以随时询问您需要实现的功能,而不是稍后实施...

I'm working on a new API called Noda Time which of course does have a date-only class in (LocalDate) but it's not ready for production yet. It may already do everything you need it to, of course, and if it nearly does then you could always ask for just the features you need to be implemented sooner rather than later...

这篇关于没有时间的.NET日期 - 有没有一个,或者我不需要一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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