Convert a datetime field to only show the date portion

Prior to SQL Server 2008, there was no such thing as a date only field in SQL Server. You could only create a datetime field. If you don't want to display the time portion of the field, use this syntax in your SQL server view or stored procedure:

CONVERT (CHAR(10), GetDate(), 101)

This will return your datetime field in the "04/15/2011" format.

Replace the "GetDate()" portion of the above with your datetime field.

You get different formats by changing the value of 101 to something else. The available options can be found on this Microsoft website: