SQL GETDATE() function returns the current date and time.
It returns the system date and time in the format ‘yyyy-mm-dd hh:mi:ss.mmm‘.
There are no parameters or arguments for the GETDATE() function.
Lets look at an example of GETDATE() in SQL.
SELECT GETDATE() AS CURRENTDATE
As you can see, it returns a current date and time of system in format ‘yyyy-mm-dd hh:mi:ss.mmm’
You can also get a date part from GETDATE() function, like if you want to get a current day and month from GETDATE() function then you can use SQL Server DAY() and month function.
Lets look at an example to get a current day and month from GETDATE() function.
SELECT GETDATE() AS CURRENTDATE, DAY(GETDATE()) AS CURRENTDAY, MONTH(GETDATE()) AS CURRENTMONTH
As you can see, it returns current day and current month as a date part .
Remember, here day() and month() function are SQL date function that is used to get a day and month from any date.