DateTime和DateTime2之间的差异 [英] difference between DateTime and DateTime2

查看:73
本文介绍了DateTime和DateTime2之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
SQL Server datetime2与datetime

.NET中的 DbType.DateTime DbType.DateTime2 有什么区别?

What is the difference between DbType.DateTime and DbType.DateTime2 in .NET?

如果我使用的是 DbType.Date ,并且想更改为DateTime类型,应该使用 DateTime 还是 DateTime2 ?

If I am using DbType.Date and I want to change to a DateTime type should I use DateTime or DateTime2?

推荐答案

DbType.DateTime DbType.DateTime2 都映射到.NET类型的 System.日期时间.如果需要其他精度和可追溯到1753年之前的日期,请使用 DateTime2 ;否则 DateTime 就足够了.

DbType.DateTime and DbType.DateTime2 both map to the .NET type System.DateTime. If you need to have additional precision and dates that go back before 1753, then use DateTime2; otherwise DateTime will suffice.

MSDN链接对此进行了很好的解释.

This MSDN link explains it pretty well.

希望这会有所帮助!

这篇关于DateTime和DateTime2之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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