Discussion Locked

get time

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

in oracle is there a way wherein i could extract only the time of a certain date column

regards,
danny

7 replies

by fenaikh

Hi
Use to_char
example:
to_char(now(), 'HH12:MI:SS')
result:
'05:39:18'
Good luck

Mohamed

by dredd

HI sir,
kindly correct my script.. it post an error of invalid number wen running

select nba_entrydate
from nb_appl
WHERE nba_entrydate = to_char('12:10', 'HH12:MI')

regards,
danny

by fenaikh

Hi
In this case the nba_entrydate should be a full date and to get PM and AM I used HH24.

select nba_entrydate
from nb_appl
WHERE to_char(nba_entrydate,'HH24:MI') = '12:10';

Good luck
Mohamed

by rsv

HI,
YES, you can extract the time from the date column using to_char function.

For example:
SELECT to_char(sysdate,'HH24:MI:SS) FROM DUAL;

Hope this will helps you.
GOOD LUCK...:)

This discussion is closed to new replies.