gpt4 book ai didi

c# - .net DateTime MaxValue 一旦存储在数据库中就不同了

转载 作者:IT王子 更新时间:2023-10-29 04:21:58 27 4
gpt4 key购买 nike

当我在数据库中存储值为 DateTime.MaxValue 的日期属性并将其取回时,存储的值不等于 DateTime.MaxValue。刻度属性已关闭。为什么是这样?

使用MS SQL,日期字段的数据类型是'datetime'

enter image description here

最佳答案

因为 SQL 日期时间的分辨率较低。

The DateTime data type in MS SQL represents Date and time data from January 1, 1753, to December 31, 9999, with an accuracy of one three-hundredth second, or 3.33 milliseconds. Values are rounded to increments of .000, .003, or .007 milliseconds.

source

The DateTime value type in .Net represents dates and times from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.) Time values are measured in 100-nanosecond units called ticks.

source

关于c# - .net DateTime MaxValue 一旦存储在数据库中就不同了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6127123/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com