only date in sql code example
Example 1: sql datetime as date
SELECT
CONVERT(DATE, GETDATE()) date;
Example 2: sql getdate date only
-- MS SQL Server
SELECT CAST(getdate() AS date);
SELECT CAST(getdate() AS varchar(10));
Example 3: how to select only a certain date sql
SELECT *
FROM sales
WHERE salesDate BETWEEN '11/11/2010 00:00:00.00' AND '11/11/2010 23:59:59.999'
Example 4: sql server format datetime to short date
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )