英文:
date time conversion seems off
问题
在某些情况下,它没有给我精确的数字,而是四舍五入到其他值。这正常吗?
CONVERT(varchar(125), dateadd(millisecond,ms,datetime), 21) as ZDateTimeMs
英文:
I encounter situation like this where I try to add Millisecond into my DateTime.
In some cases, it didn't give me the exact number and it got rounded to something else.
Is it normal ?
CONVERT(varchar(125), dateadd(millisecond,ms,datetime), 21) as ZDateTimeMs
答案1
得分: 1
从datetime
:
datetime
值会被舍入到 .000、.003 或 .007 秒的增量,如下表所示。
用户指定值 系统存储值
01/01/98 23:59:59.999 1998-01-02 00:00:00.000
01/01/98 23:59:59.995
01/01/98 23:59:59.996
01/01/98 23:59:59.997
01/01/98 23:59:59.998 1998-01-01 23:59:59.997
01/01/98 23:59:59.992
01/01/98 23:59:59.993
01/01/98 23:59:59.994 1998-01-01 23:59:59.993
01/01/98 23:59:59.990
01/01/98 23:59:59.991 1998-01-01 23:59:59.990
英文:
From datetime
:
datetime
values are rounded to increments of .000, .003, or .007 seconds, as shown in the following table.
User-specified value System stored value
01/01/98 23:59:59.999 1998-01-02 00:00:00.000
01/01/98 23:59:59.995
01/01/98 23:59:59.996
01/01/98 23:59:59.997
01/01/98 23:59:59.998 1998-01-01 23:59:59.997
01/01/98 23:59:59.992
01/01/98 23:59:59.993
01/01/98 23:59:59.994 1998-01-01 23:59:59.993
01/01/98 23:59:59.990
01/01/98 23:59:59.991 1998-01-01 23:59:59.990
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论