Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show only the time in oracle?

I have table that has date field. When I run a query, I see this:

01/10/2009 22:10:39

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

like image 935
Gold Avatar asked Oct 14 '09 19:10

Gold


1 Answers

you can try this:

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 have 24 hours style use

SELECT TO_CHAR(yourval, 'HH24:MI:SS') FROM yourtable;
like image 89
Amirshk Avatar answered Oct 11 '22 14:10

Amirshk