SQL> select to_char(sysdate, 'hh24:mi:ss') "Current Time",
2 extract(hour from to_timestamp(to_char(sysdate, 'dd-mon-yy hh24:mi:ss'))) "Hour",
3 extract(minute from to_timestamp(to_char(sysdate, 'dd-mon-yy hh24:mi:ss'))) "Minute",
4 extract(second from to_timestamp(to_char(sysdate, 'dd-mon-yy hh24:mi:ss'))) "Second"
5 from dual;
Current Hour Minute Second
-------- ---------- ---------- ----------
12:40:02 12 40 2
Of course you could just do the following too:
SQL> select to_char(sysdate, 'hh24:mi:ss') "Current Time",
2 to_char(sysdate, 'hh24') "Hour",
3 to_char(sysdate, 'mi') "Minute",
4 to_char(sysdate, 'ss') "Second"
5 from dual;
Current Ho Mi Se
-------- -- -- --
12:40:10 12 40 10
[Updated on: Sun, 09 July 2006 11:51]
Report message to a moderator