Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: time conversion

Re: time conversion

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Wed, 17 Feb 1999 21:47:01 +0100
Message-ID: <36cb2aca$0$26873@newton>


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'
        )

from dual;

Arjan. Received on Wed Feb 17 1999 - 14:47:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US