Convert datetime field to just a date field in SQL (Oracle)
Just use the function TRUNC.
SELECT DISTINCT
TRUNC(C.RECEIPTDATE),
(I.CLIENTID ||' - '||PO.CLIENTNAME) AS CLIENT,
D.INVOICEID,
TRUNC(D.SVCFROMDATE),
TRUNC(D.SVCTODATE),
D.SVCCODE
FROM M_EQP_ORDERS
WHERE.....
Use to_char function:
SELECT DISTINCT
to_char(C.RECEIPTDATE,'DD/MM/YYYY'),
(I.CLIENTID ||' - '||PO.CLIENTNAME) AS CLIENT,
D.INVOICEID,
D.SVCFROMDATE,
D.SVCTODATE,
D.SVCCODE
FROM M_EQP_ORDERS
WHERE.....
DEPENDS on the data type.
If the column is DATE
data type, then, as suggested already, TRUNC
would do the job to display. But, if your locale-specific NLS date settings are different, then you will still see the time portion as midnight.
Else, you need to use TO_DATE
with proper FORMAT
and apply TRUNC
to it.
update
If you only want to display, use TO_CHAR
, else, if you have a filter in your WHERE
clause, then remember TO_CHAR
doesn't return DATE
, it converts it into literal.