当前位置:网站首页>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
边栏推荐
- 4. Object mapping Mapster
- Go 語言的 Context 詳解
- 【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
- OpenSergo 即将发布 v1alpha1,丰富全链路异构架构的服务治理能力
- Lombok plug-in
- [daily training -- Tencent selected 50] 292 Nim games
- Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture
- Distributed global ID generation scheme
- 目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
- 淘宝商品详情页API接口、淘宝商品列表API接口,淘宝商品销量API接口,淘宝APP详情API接口,淘宝详情API接口
猜你喜欢
CVE-2021-3156 漏洞复现笔记
An example of multi module collaboration based on NCF
Digital IC interview summary (interview experience sharing of large manufacturers)
Red Hat安装内核头文件
What is message queuing?
AI face editor makes Lena smile
Five core elements of architecture design
数字IC面试总结(大厂面试经验分享)
判断文件是否为DICOM文件
Cve-2021-3156 vulnerability recurrence notes
随机推荐
Type de texte de commutation d'entrée et de mot de passe de l'applet natif
Differences and introduction of cluster, distributed and microservice
980. 不同路径 III DFS
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
SAP webservice 测试出现404 Not found Service cannot be reached
AI face editor makes Lena smile
分布式事务解决方案之2PC
Question 102: sequence traversal of binary tree
高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
5. 数据访问 - EntityFramework集成
On the difference between FPGA and ASIC
Flinksql 读写pgsql
C#可空类型
Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
How does mapbox switch markup languages?
[reading of the paper] a multi branch hybrid transformer network for channel terminal cell segmentation
pytorch_ 01 automatic derivation mechanism
Three level menu data implementation, nested three-level menu data
How to improve website weight
What is dependency injection (DI)