日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

SQL日期函数获取系统当前时间

發(fā)布時(shí)間:2023/12/9 windows 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SQL日期函数获取系统当前时间 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

SQL日期函數(shù)

SQL日期函數(shù)中的類型碼可以為0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
,20,21,22,23,24,25,100,101,102,103,104,105,106,107,108,109,100,
110,111,112,113,114,120,121,126,127,130,131

函數(shù)結(jié)果
select CONVERT(varchar(30),getdate(),0)09 13 2017 3:51PM
select CONVERT(varchar(30),getdate(),1)09/13/17
select CONVERT(varchar(30),getdate(),2)17.09.13
select CONVERT(varchar(30),getdate(),3)13/09/17
select CONVERT(varchar(30),getdate(),4)13.09.17
select CONVERT(varchar(30),getdate(),5)13-09-17
select CONVERT(varchar(30),getdate(),6)13 09 17
select CONVERT(varchar(30),getdate(),7)09 13, 17
select CONVERT(varchar(30),getdate(),8)15:51:54
select CONVERT(varchar(30),getdate(),9)09 13 2017 3:51:54:550PM
select CONVERT(varchar(30),getdate(),10)09-13-17
select CONVERT(varchar(30),getdate(),11)17/09/13
select CONVERT(varchar(30),getdate(),12)170913
select CONVERT(varchar(30),getdate(),13)13 09 2017 15:51:54:550
select CONVERT(varchar(30),getdate(),14)15:51:54:550
select CONVERT(varchar(30),getdate(),20)2017-09-13 15:51:54
select CONVERT(varchar(30),getdate(),21)2017-09-13 15:51:54.550
select CONVERT(varchar(30),getdate(),22)09/13/17 3:51:54 PM
select CONVERT(varchar(30),getdate(),23)2017-09-13
select CONVERT(varchar(30),getdate(),24)15:51:54
select CONVERT(varchar(30),getdate(),25)2017-09-13 15:51:54.550
select CONVERT(varchar(30),getdate(),100)09 13 2017 3:51PM
select CONVERT(varchar(30),getdate(),101)09/13/2017
select CONVERT(varchar(30),getdate(),102)2017.09.13
select CONVERT(varchar(30),getdate(),103)13/09/2017
select CONVERT(varchar(30),getdate(),104)13.09.2017
select CONVERT(varchar(30),getdate(),105)13-09-2017
select CONVERT(varchar(30),getdate(),106)13 09 2017
select CONVERT(varchar(30),getdate(),107)09 13, 2017
select CONVERT(varchar(30),getdate(),108)15:51:54
select CONVERT(varchar(30),getdate(),109)09 13 2017 3:51:54:550PM
select CONVERT(varchar(30),getdate(),110)09-13-2017
select CONVERT(varchar(30),getdate(),111)2017/09/13
select CONVERT(varchar(30),getdate(),112)20170913
select CONVERT(varchar(30),getdate(),113)13 09 2017 15:51:54:550
select CONVERT(varchar(30),getdate(),114)15:51:54:550
select CONVERT(varchar(30),getdate(),120)2017-09-13 15:51:54
select CONVERT(varchar(30),getdate(),121)2017-09-13 15:51:54.550
select CONVERT(varchar(30),getdate(),126)2017-09-13T15:51:54.550
select CONVERT(varchar(30),getdate(),127)2017-09-13T15:51:54.550
select CONVERT(varchar(30),getdate(),130)22 ?? ????? 1438 3:51:54:550P
select CONVERT(varchar(30),getdate(),131)22/12/1438 3:51:54:550PM

其中,21,25,121效果相同(2017-09-13 15:51:54.550 )。
其中,在select語句中需要獲取固定格式日期時(shí),只需將getdate()替換成需要查找的字段名,需要設(shè)置的該字段的別名直接在后面添加即可,

如:select CONVERT(varchar(30), RQ_REQ_DATE, 21) from td.REQ;

查詢結(jié)果:

總結(jié)

以上是生活随笔為你收集整理的SQL日期函数获取系统当前时间的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。