- DATEPART(DATEPORTION,ANYDATE) => O/P:NUMERIC OUTPUT
- DATENAME(DATEPORTION,ANYDATE) =>O/P:STRING OUTPUT
EXAMPLES:
=>DISPLAY ONLY MONTH VALUE OF CURRENT DATETIME
select datepart(mm,getdate()) o/p:5
=>DISPLAY MONTH NAME OF CURRENT DATETIME
select datename(mm,getdate()) o/p:may
=>DISPLAY WEEKDAY OF CURRENT DATE
select datename(dw,getdate()) o/p:monday
No comments:
Post a Comment