T- SQL- Date Functions
In T-SQL, Date functions are used to generate the query for date and time.
GETDATE () returns the current date with the time.
The syntax of the function-
The query will return the current date in T-SQL.
It gives the part of the date or time.
The syntax of the function -
The query returns the part of the current month in T-SQL.
It displays the date and time by subtracting or adding the date and time interval.
The syntax for the function -
The query below will return after the date and time of ten days from the current date and time in T-SQL.
DATEDIFF () displays the date and time between one or many dates.
The query below returns the gap of hours between 2020-10-12 and 2020-10-09 in MS SQL Server.
It displays the date and time in various formats.
The queries return the date and time in many formats in Transact-SQL.