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

Home -> Community -> Usenet -> c.d.o.server -> Re: How To Extract Hour From A Date Column In A Table?

Re: How To Extract Hour From A Date Column In A Table?

From: pkl <rc5_at_monochrom.at>
Date: Thu, 06 Apr 2006 00:43:57 +0200
Message-ID: <979c8$4434487a$54728e3c$28326@news.chello.at>


Rauf Sarwar wrote:

> cdavis10717_at_comcast.net wrote:
> 

>>All,
>>
>>I can not work out the proper syntax to extract the hour from a date
>>column in my table.
>>
>>Examples I have found select from DUAL, but I want it from a user table
>>instead.
>>
>>An example like:
>>
>>SELECT extract(hour from my_date_column 'HH24') as TheHour from
>>my_table;
>>
>>doesn't work at all, I get syntax error.
>>
>>Has anyone done this and can provide working syntax?
>>Thanks in advance.
>>
>>CD
> 
> 
> select to_char(your_date_column, 'HH24') from your_table;
> This is ofcourse all in the docs.
> 
> Regards
> /Rauf
> 

Well,
beginning from 9.0.1 you will also find in the docs some syntax like

SELECT EXTRACT(HOUR FROM my_date_column) FROM my_table

see e.g.
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions050.htm#i1017161

Regards Peter Received on Wed Apr 05 2006 - 17:43:57 CDT

Original text of this message

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