Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: time conversion
Shawn Bernard wrote
>I am coding in PL/SQL and i need to take a number (ranging from 0 to
23)
>and convert it to the appropriate hour. For example: 4 ==> 4:00 AM
(or
>4 AM), 14 ==> 2:00 PM
Note that you can not store just time in an Oracle date field. That is: a date always holds both date and time (where the time can be set to 0:00:00).
When converting numbers to hours, do not use HH, but use HH24. Like:
select to_char
( to_date( '01-JAN-1999 14:00', 'DD-MON-YYYY HH24:MI') , 'HH24:MI:SS' )
Arjan. Received on Wed Feb 17 1999 - 14:47:01 CST
![]() |
![]() |