Get only date without time in Oracle

Viewed 131516

I have this sql request to retrieve some data and I have this columd 'pa.fromdate' which returns a date and a time. How do I get it to return only date in 'DD.MM.YYYY' format. I've tried something like trunc(to_date(pa.fromdate, 'MM.DD.YYYY')). Doesn't work. How can I do that?

SELECT pro.inscatid,
  t.epotypeid,
  t.paysum,
  t.note,
  pa.blankno,
  pa.blankseria,
  pa.signtime,
  pa.fromdate,
  ca.accnum,
  ou.name,
  cst.inn,
  pkg_customers.GETCUSTOMERFULLNAME(cst.id) cstfio
FROM epo_orders t
LEFT JOIN epo_orderdetails od
ON od.orderid      = t.id
AND od.iscanceldoc = -1
LEFT JOIN plc_Agree pa
ON pa.id = od.agreeid
LEFT JOIN pro_products pro
ON pro.id = pa.proid
LEFT JOIN nsk_transferdetails td
ON td.transferid = pa.transferid
AND td.orgtypeid = 4
LEFT JOIN cst_customers cst
ON cst.id = t.cstid
LEFT JOIN cst_cstaccounts ca
ON ca.id = t.cstaccid
LEFT JOIN nsk_orgunits ou
ON td.orgunitid    = ou.id
WHERE t.epotypeid IN (159,1010,169,175)
AND rownum         <20;
7 Answers

SELECT to_char(Column_name,'DD/MM/YYYY') Column_Name FROM Table_Name

To get data for only date filter, use TRUNC in front of column name.

Like use TRUNC(table.column_name) = 'DD-MM-YYYY'

Example: TRUNC(Employee.Joining_Time)= '01-JAN-2021'

Just use same format of date as per in the column used where you have full string of date concat time.

Thanks.

Related