How to show only time in oracle?

I have a table with a date field. When I run the query, I see the following:

10/01/2009 10:10:39 PM

How can I get only time (IE: 22:10:39)

+6
sql oracle oracle10g
source share
4 answers

you can try the following:

SELECT TO_CHAR(yourval, 'DD-MON-YYYY HH:MI:SS') FROM yourtable; SELECT TO_CHAR(yourval, 'HH:MI:SS') FROM yourtable; 

Edit: as @steven pointed out to use the style for 24 hours

 SELECT TO_CHAR(yourval, 'HH24:MI:SS') FROM yourtable; 
+13
source share

You need the HH24 format, since HH is only a 12-hour date.

 select to_char(SYSDATE, 'HH24:MI:SS') from dual select to_char(YourDateColumn, 'HH24:MI:SS') from YourTable 
+5
source share

SELECT TO_CHAR (SYSDATE, 'hh: mi: ss') FROM DUAL

+4
source share

SELECT TO_CHAR (DATE_COLUMN, 'HH24: MI: SS') from TABLE;

+1
source share

All Articles