SQL Server 获取服务器时间的sql语句
时间:2020-10-31 14:30 作者:admin
SQL SERVER 2000用sql语句如何获得当前系统时间
就是用GETDATE();
Sql中的getDate()
Sql Server 中一个非常强大的日期格式化函数
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2008 10:57AMSelect CONVERT(varchar(100), GETDATE(), 1): 05/16/08Select CONVERT(varchar(100), GETDATE(), 2): 08.05.16Select CONVERT(varchar(100), GETDATE(), 3): 16/05/08Select CONVERT(varchar(100), GETDATE(), 4): 16.05.08Select CONVERT(varchar(100), GETDATE(), 5): 16-05-08Select CONVERT(varchar(100), GETDATE(), 6): 16 05 08Select CONVERT(varchar(100), GETDATE(), 7): 05 16, 08Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46Select CONVERT(varchar(100), GETDATE(), 9): 05 16 2008 10:57:46:827AMSelect CONVERT(varchar(100), GETDATE(), 10): 05-16-08Select CONVERT(varchar(100), GETDATE(), 11): 08/05/16Select CONVERT(varchar(100), GETDATE(), 12): 080516Select CONVERT(varchar(100), GETDATE(), 13): 16 05 2008 10:57:46:937Select CONVERT(varchar(100), GETDATE(), 14): 10:57:46:967Select CONVERT(varchar(100), GETDATE(), 20): 2008-05-16 10:57:47Select CONVERT(varchar(100), GETDATE(), 21): 2008-05-16 10:57:47.157Select CONVERT(varchar(100), GETDATE(), 22): 05/16/08 10:57:47 AMSelect CONVERT(varchar(100), GETDATE(), 23): 2008-05-16Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47Select CONVERT(varchar(100), GETDATE(), 25): 2008-05-16 10:57:47.250Select CONVERT(varchar(100), GETDATE(), 100): 05 16 2008 10:57AMSelect CONVERT(varchar(100), GETDATE(), 101): 05/16/2008Select CONVERT(varchar(100), GETDATE(), 102): 2008.05.16Select CONVERT(varchar(100), GETDATE(), 103): 16/05/2008Select CONVERT(varchar(100), GETDATE(), 104): 16.05.2008Select CONVERT(varchar(100), GETDATE(), 105): 16-05-2008Select CONVERT(varchar(100), GETDATE(), 106): 16 05 2008Select CONVERT(varchar(100), GETDATE(), 107): 05 16, 2008Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49Select CONVERT(varchar(100), GETDATE(), 109): 05 16 200810:57:49:437AMSelect CONVERT(varchar(100), GETDATE(), 110): 05-16-2008Select CONVERT(varchar(100), GETDATE(), 111): 2008/05/16Select CONVERT(varchar(100), GETDATE(), 112): 20080516Select CONVERT(varchar(100), GETDATE(), 113): 16 05 2008 10:57:49:513Select CONVERT(varchar(100), GETDATE(), 114): 10:57:49:547Select CONVERT(varchar(100), GETDATE(), 120): 2008-05-16 10:57:49Select CONVERT(varchar(100), GETDATE(), 121): 2008-05-16 10:57:49.700Select CONVERT(varchar(100), GETDATE(), 126): 2008-05-16T10:57:49.827Select CONVERT(varchar(100), GETDATE(), 130): 18 ???? ?????? 142710:57:49:907AMSelect CONVERT(varchar(100), GETDATE(), 131): 18/04/142710:57:49:920AM
获取SQL Server服务器时间
insert into tablename (Date) value getDate()
"select getdate() as serverDate"
然后读取serverDate属性即为SQL Server服务器时间。
也可用下面语句直接获取:
select getdate()
select CURRENT_TIMESTAMP
得到时间如下格式:
2016-07-07 14:07:15.670
(责任编辑:admin)