Changing datetime to date data type with date format?

150 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 answers

0
Ionic On

Try this:

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

These SQL will useful to you.

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

Thank you