-- Each datepart and its abbreviations return the same value.
-- Year Name
-- Datepart
SELECT DATENAME(YEAR,GETDATE())
-- Abbreviations
SELECT DATENAME(YYYY,GETDATE())
SELECT DATENAME(YY,GETDATE())
-- Day of Year
-- Datepart
SELECT DATENAME(DAYOFYEAR,GETDATE())
-- Abbreviations
SELECT DATENAME(y,GETDATE())
SELECT DATENAME(DY,GETDATE())
-- Quarter
-- Datepart
SELECT DATENAME(QUARTER,GETDATE())
-- Abbreviations
SELECT DATENAME(Q,GETDATE())
SELECT DATENAME(QQ,GETDATE())
-- Month Name
-- Datepart
SELECT DATENAME(MONTH,GETDATE())
-- Abbreviations
SELECT DATENAME(M,GETDATE())
SELECT DATENAME(MM,GETDATE())
-- Week
-- Week Day Name
-- Datepart
SELECT DATENAME(WEEKDAY,GETDATE())
-- Abbreviations
SELECT DATENAME(DW,GETDATE())
SELECT DATENAME(W,GETDATE())
-- Week Number in year
-- Date Part
SELECT DATENAME(WEEK,GETDATE())
-- Abbreviations
SELECT DATENAME(WK,GETDATE())
-- Week Number in year as per ISO
-- Date Part
SELECT DATENAME(ISO_WEEK,GETDATE())
-- Abbreviations
SELECT DATENAME(ISOWK,GETDATE())
SELECT DATENAME(ISOWW,GETDATE())
-- Day Number of Month
-- Datepart
SELECT DATENAME(DAY,GETDATE())
-- Abbreviations
SELECT DATENAME(DD,GETDATE())
-- Hour
-- Datepart
SELECT DATENAME(HOUR,GETDATE())
-- Abbreviations
SELECT DATENAME(HH,GETDATE())
-- Minute
-- Datepart
SELECT DATENAME(MINUTE,GETDATE())
-- Abbreviations
SELECT DATENAME(MI,GETDATE())
SELECT DATENAME(N,GETDATE())
-- Seconds
-- Datepart
SELECT DATENAME(SECOND,GETDATE())
-- Abbreviations
SELECT DATENAME(S,GETDATE())
SELECT DATENAME(SS,GETDATE())
-- Milli seconds
-- Datepart
SELECT DATENAME(MILLISECOND,GETDATE())
-- Abbreviations
SELECT DATENAME(MS,GETDATE())
-- Microseconds
-- Datepart
SELECT DATENAME(MICROSECOND,GETDATE())
-- Abbreviations
SELECT DATENAME(MCS,GETDATE())
-- NanoSeconds
-- Datepart
SELECT DATENAME(NANOSECOND,GETDATE())
-- Abbreviations
SELECT DATENAME(NS,GETDATE())
No comments:
Post a Comment