In my database(an Oracle 11 database) I have a attribute which is of Date type but has a time in the value for some reason, idk why it is Date type and not DateTime. When I select this ” Position_time” Of course it just displays the date but when i attempt a filter on the column more options are shown of the same date for multiple times so a time value is present in this column even though it is of date type. Link to picture of position_time context
As seen in the image even though the attribute is of type Date it contains a time “component” This is not shown in the overview btw only when i try to filter the column idk of that matters.
Id like to extract this time from my date. I’ve seen plenty of posts explaining how to extract from a DateTime column but not from a Date. I cannot change the type of this column. Is there any way to achieve this? for example
select format(tr.position_time) from positions
Advertisement
Answer
Do you mean like this :
select to_char(to_date(position_time,'dd-mm-yyyy HH24:MI:SS'), 'HH24:MI:SS') time from positions;
if you already passing the date type as parameter then just use to_char
function for extract the time from it.
E.g:
Select to_char(position_time,'HH24:MI:SS') from positions;