SQL Server > Date Time related

Return day, month, and year in SQL Server

How to return day, month, and year in the SQL Server database?


To return day, month and year of the date we can use DAY, MONTH and YEAR function by passing the current date. Similarly, to get day, month and year of other date simply pass other date as parameter to these functions.

SELECT
DAY(GETDATE()) as Day,
MONTH(GETDATE()) as Month,
YEAR(GETDATE()) As Year

 Views: 7719 | Post Order: 73



Write for us






Hosting Recommendations