Quantcast
Viewing all articles
Browse latest Browse all 4871

I need date only with date data type

Hello all,

Let's say I have this statement I am working with:

SELECT invoice_date
FROM invoices
WHERE (NOT (invoice_date IS NULL))

The result is:

invoice_date
1992-08-08 00:00:00.000
1992-08-08 00:00:00.000
1992-08-09 00:00:00.000
1992-08-10 00:00:00.000
1992-08-10 00:00:00.000

What I need is the result to say1992-08-08 without the time but keep it in the DATETIME data type. I have tried many things like:
CAST(invoices.invoice_date AS DATE) AS invoice_date= 'Type DATE is not a defined system type'
CONVERT(varchar(10), invoices.invoice_date, 120) AS invoice_date= result desired, but output is text data type...no good
CONVERT(DATETIME, invoices.invoice_date, 120) AS invoice_date = 1992-08-08 00:00:00.000 ...no good
LEFT(CONVERT(DATETIME, invoices.invoice_date, 120), 10) AS invoice_date = Aug 8 199
DATE_FORMAT(invoices.invoice_date,'%m-%d-%y') AS...


Viewing all articles
Browse latest Browse all 4871

Trending Articles