SQL DateTime


GETDATE()

COUNTS IN DAYS

Use GETDATE() to get the current date/time


SELECT GETDATE() AS Result

MONTH()

Use MONTH() to return a numeric value of the current month


SELECT MONTH(GETDATE()) AS Result

-- or use DATEPART()

SELECT DATEPART(month, GETDATE()) AS Result

DATENAME()

Use DATENAME() to return a string value istead:


SELECT DATENAME(month, GETDATE()) AS Result

DATEDIFF()

Use DATEDIFF() to find the difference between two dates