1 select '当前时间(datepart)'=GETDATE(), 年=DATEPART(YEAR,GETDATE()),季=DATEPART(QUARTER,GETDATE()),月=DATEPART(Month,GETDATE()), 2 周=DATEPART(WEEK,GETDATE()),周日数=DATEPART(WEEKDAY,GETDATE()),日=DATEPART(DAY,GETDATE()), 3 年日数=DATEPART(DAYOFYEAR,GETDATE()),时=DATEPART(HOUR,GETDATE()),分=DATEPART(MINUTE,GETDATE()), 4 秒=DATEPART(SECOND,GETDATE()),毫秒=DATEPART(MILLISECOND,GETDATE()) 5 6 select '当前时间(datename)'=GETDATE(), 年=DATENAME(YEAR,GETDATE()),季=DATENAME(QUARTER,GETDATE()),月=DATENAME(Month,GETDATE()), 7 周=DATENAME(WEEK,GETDATE()),周日数=DATENAME(WEEKDAY,GETDATE()),日=DATENAME(DAY,GETDATE()), 8 年日数=DATENAME(DAYOFYEAR,GETDATE()),时=DATENAME(HOUR,GETDATE()),分=DATENAME(MINUTE,GETDATE()), 9 秒=DATENAME(SECOND,GETDATE()),毫秒=DATENAME(MILLISECOND,GETDATE())
|