DATE function extracts the date part of a date or date/time expression. The equivalent function in Microsoft SQL Server is somewhat
DATEPART, but the
CONVERT function may provide a better result depending on the required format.
|1000||John Smith||1995-12-03 13:23:30.657|
|1001||Fred White||2001-10-12 09:41:44.125|
|1002||Jane Scott||1998-05-01 11:36:16.334|
|1003||Samuel Williams||1991-01-03 15:19:51.293|
In this example, we want to find out what date the employees’ accounts were created.
SELECT employeeName as [Employee Name], DATE(accountCreated) as [Acc Created] FROM employees
|Employee Name||Acc Created|