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: date and time comparision, calculauion

Re: date and time comparision, calculauion

From: Jim Yoshii <yoshii_at_planet.net>
Date: 1997/02/26
Message-ID: <3314F5BF.58B9@planet.net>#1/1

John Remus wrote:
>
> Hi everybody!
>
> I have a little problem with the date datatype handling.
>
> I like to select a date(time) type column and restrict it for example
> between 20:00 and 7:00.
> I tried like this:
>
> select to_char(time,'HH:MI')
> from time_table
> where to_date(to_char(time,'HH:MI')) > to_date('20:00','HH:MI') and
> to_date(to_char(time,'HH:MI')) < to_date('07:00','HH:MI')
> ;
>
> In the same way I would like to know how I can calculate times and
> dates with each other.
>
> Thank's in advance
>
> John Remus
> John_Steven.Remus_at_akh-wien.ac.at
> General Hospital Vienna
> Austria
> John Remus
> John_Steven.Remus_at_akh-wien.ac.at
> General Hospital Vienna
> Austria

Date/times are stored as a floating point number, representing days since some base date. The time of day is expressed as a fractional day, so 1/24 equals 1 AM 12/24 is noon and so on.

The above could be accomplished by:

select to_char(time,'HH:MI')
from time_table
where time - trunc(time) between 7/24 and 20/24;  


         James H. Yoshii
 IntelliTech Business Solutions

        yoshii_at_planet.net


Received on Wed Feb 26 1997 - 00:00:00 CST

Original text of this message

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