首页 > 代码库 > SQL_时间取得

SQL_时间取得

SELECT GETDATE() as systemTime--获取系统时间    SELECT YEAR(GETDATE()) AS mytime--获取系统年份SELECT month(GETDATE()) AS mytime--获取系统月份SELECT day(GETDATE()) AS mytime--获取系统日SELECT CONVERT(nvarchar(20),GETDATE(),10) as myTimeSELECT DATEPART(HOUR,GETDATE())as myTime -- 获取时SELECT DATEPART(MINUTE,GETDATE())as myTime-- 获取分SELECT DATEPART(SECOND,GETDATE())as myTime-- 获取秒SELECT DATENAME(DW,GETDATE()) AS WEEKSELECT DATENAME(WW,GETDATE()) AS 本周是一年的第几周SELECT DATENAME(DY,GETDATE()) AS 今天是一年当中的第几天

 

SQL_时间取得