Reputation: 57
I have two items in Oracle APEX and I want to make one item to have by default part of value of another item. I have tried by using SQL function TRIM
:
SELECT TRIM('HH24:MI ' FROM TIME_AND_DATE) AS DATE FROM BILL;
TIME_AND_DATE - (format mask: DD-MM-YYYY HH24:MI)
DATE - (format mask: DD-MM-YYYY)
But it returns an error.
Upvotes: 0
Views: 165
Reputation: 142705
If TIME_AND_DATE
columns datatype is DATE
and you want to put only date part of it into a variable, then TRUNC
it (not TRIM
).
SQL> select sysdate date_and_time,
2 trunc(sysdate) truncated
3 from dual;
DATE_AND_TIME TRUNCATED
------------------- -------------------
15.05.2020 15:07:12 15.05.2020 00:00:00
SQL>
Next step is just the presentation; use TO_CHAR
(or format mask in front end (Apex?)) to display it as you want, e.g.
SQL> select to_char(trunc(sysdate), 'dd-fmmonth-yyyy') result from dual;
RESULT
--------------------
15-svibanj-2020
SQL>
Upvotes: 1