DATENAME()
DATENAME() is very common and most useful function to find out the date name from the datetime value. Example
-- Get Today
SELECT DATENAME(dw, getdate()) AS 'Today Is'
-- Get Mont name
SELECT DATENAME(month, getdate()) AS 'Month'
SELECT DATENAME(dw, getdate()) AS 'Today Is'
-- Get Mont name
SELECT DATENAME(month, getdate()) AS 'Month'
Output :
Month IsAugust
No comments:
Post a Comment