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 -> extracing the hour from a date

extracing the hour from a date

From: <laredotornado_at_zipmail.com>
Date: 25 Mar 2005 09:12:54 -0800
Message-ID: <1111770774.930477.65000@f14g2000cwb.googlegroups.com>


Hello,

   I am using Oracle 8.1.7 to try and extract hours from dates. I want to write a SELECT statement to return only the 2-digit hour from a date. But i'm having little success. If I try ...

select trunc(sysdate, 'HH24') from dual

I get

2005-03-25 12:00:00.0

but when I try

select to_char(trunc(sysdate, 'HH24')) from dual

I get

25-MAR-05 making it impossible for me to use SUBSTR to extract the 2-digit hour. Are there other functions that I should be using?

Thanks, - Received on Fri Mar 25 2005 - 11:12:54 CST

Original text of this message

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