sql的一些事件处理

select getdate()

select Convert(varchar(10),getdate(),120) yyyy-mm-dd
select Convert(varchar(20),getdate(),120) yyyy-mm-dd hh:mi:ss
select Convert(varchar,getdate(),23) 年月日
select DATEDIFF(day,getdate(),convert(datetime,'2008-08-08 18:00:00',120)) --时间差
select DATENAME(dw,getdate()) 
--当前时间是一周内的第几天(中文,返回NVARCHAR型)

原文地址:https://www.cnblogs.com/shinima/p/5481102.html