SELECT GETDATE()
Returns: 2008-09-22 15:24:13.790
I want that date part without the time part: 2008-09-22 00:00:00.000
How can I get that?
SELECT GETDATE()
Returns: 2008-09-22 15:24:13.790
I want that date part without the time part: 2008-09-22 00:00:00.000
How can I get that?
I think this would work in your case:
why don't you use DATE_FORMAT( your_datetiem_column, '%d-%m-%Y' ) ?
EX:
select DATE_FORMAT( some_datetime_column, '%d-%m-%Y' ) from table_name
you can change sequence of m,d and year by re-arranging
'%d-%m-%Y'
partYou can use the
CONVERT
function to return only the date. See the link(s) below:Date and Time Manipulation in SQL Server 2000
CAST and CONVERT
The syntax for using the convert function is:
Date:
Time:
Even using the ancient MSSQL Server 7.0, the code here (courtesy of this link) allowed me to get whatever date format I was looking for at the time:
It produced this output:
Starting from SQL SERVER 2012, you can do this:
SELECT FORMAT(GETDATE(), 'yyyy-MM-dd 00:00:00.000')