当前位置:网站首页>SQL Server 2008 各种DateTime的取值范围
SQL Server 2008 各种DateTime的取值范围
2022-07-07 00:35:00 【51CTO】
在SQL SERVER中DATETIME表示的时间为00:00:00到23:59:59.997,它的时间精度为1/300秒,在使用时会舍入到舍入到 .000、.003 或 .007 秒三个增量。如下表是DATETIME秒的小数部分精度的舍入。
用户指定的值 | 使用DateTime类型时系统存储的值 |
1998-1-1 23:59:59.990 1998-1-1 23:59:59.991 | 1998-01-01 23:59:59.990 |
1998-1-1 23:59:59.992 1998-1-1 23:59:59.993 1998-1-1 23:59:59.994 | 1998-01-01 23:59:59.993 |
1998-1-1 23:59:59.995 1998-1-1 23:59:59.996 1998-1-1 23:59:59.997 1998-1-1 23:59:59.998 | 1998-01-01 23:59:59.997 |
1998-1-1 23:59:59.999 | 1998-01-02 00:00:00.000 |
在SQL SERVER 2008中新增了Datetime2类型,可以提供更高的时间精度,且可以自定义时间精度,以后可以使用这种数据类型。Datetime2的精度是100 纳秒。
SQL Server 2008除了DateTime和SmallDateTime之外,又新增了四种时间类型,分别为:date,time,datetime2和datetimeoffset。
各时间类型范围、精度一览表:
数据类型 | 时间范围 | 精度 |
Smalldatetime | 1900-01-01 到 2079-06-06 00:00:00 到 23:59:59 | 分钟 |
Datetime | 1753-01-01到9999-12-31 00:00:00 到 23:59:59.997 | 3.33毫秒 |
Time | 00:00:00.0000000 到 23:59:59.9999999 | 100 纳秒 |
Date | 0001-01-01 到 9999-12-31 | 天 |
Datetime2 | 0001-01-01 到 9999-12-31 00:00:00 到 23:59:59.9999999 | 100 纳秒 |
Datetimeoffset | 0001-01-01 到 9999-12-31 00:00:00 到 23:59:59.9999999 -14:00 到 +14:00 | 100 纳秒 |
各时间类型表达式一览表: 数据类型 输出 time 12:35:29. 1234567 date 2007-05-08 smalldatetime 2007-05-08 12:35:00 datetime 2007-05-08 12:35:29.123 datetime2 2007-05-08 12:35:29. 1234567 datetimeoffset 2007-05-08 12:35:29.1234567 +12:15
边栏推荐
- SQL query: subtract the previous row from the next row and make corresponding calculations
- Explication contextuelle du langage Go
- 盘点国内有哪些EDA公司?
- Wechat applet Bluetooth connects hardware devices and communicates. Applet Bluetooth automatically reconnects due to abnormal distance. JS realizes CRC check bit
- Go 語言的 Context 詳解
- How to improve website weight
- Input of native applet switches between text and password types
- 高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
- In memory, I moved from CSDN to blog park!
- 5. Data access - entityframework integration
猜你喜欢
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server
分布式全局ID生成方案
不同网段之间实现GDB远程调试功能
PTA 天梯赛练习题集 L2-004 搜索树判断
Get the way to optimize the one-stop worktable of customer service
[云原生]微服务架构是什么?
AI face editor makes Lena smile
What is dependency injection (DI)
Bat instruction processing details
Distributed global ID generation scheme
随机推荐
Mybaits multi table query (joint query, nested query)
架构设计的五个核心要素
Sidecar mode
SAP ABAP BDC (batch data communication) -018
[daily training -- Tencent selected 50] 292 Nim games
Educational Codeforces Round 22 B. The Golden Age
OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
"Multimodal" concept
集群、分布式、微服务的区别和介绍
盘点国内有哪些EDA公司?
R language [logic control] [mathematical operation]
PTA 天梯赛练习题集 L2-003 月饼 测试点2,测试点3分析
Input of native applet switches between text and password types
Nodejs get client IP
软件测试面试技巧
4. Object mapping Mapster
How does mapbox switch markup languages?
Question 102: sequence traversal of binary tree
原生小程序 之 input切换 text与password类型
Polynomial locus of order 5