Changing datetime to date data type with date format?

159 Views Asked by At
SELECT CAST(CONVERT(varchar, dateissued, 105) AS date) FROM table1;

The above SQL statement returns null values instead of expected values. I cannot spot the error.

2

There are 2 best solutions below

0
On

Try this:

SELECT CONVERT(nvarchar(50),CONVERT(date,dateissued ,105)) as newDate
0
On

These SQL will useful to you.

SELECT DATE_FORMAT('2010-06-25 09:16:04','%m/%d/%Y') AS DATE 

Thank you