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: Good question on dates

Re: Good question on dates

From: <argosy22_at_my-deja.com>
Date: Wed, 23 Feb 2000 22:24:32 GMT
Message-ID: <891mmq$hhp$1@nnrp1.deja.com>


HI all,

Actually, I think I figured it out again.

If we use the number field as the numerator in a fraction, we could use it in a function like:

Select to_char( (sysdate + x/24), 'YYYY:MM:DD, HH24:MM' ) NEW_DATE FROM DUAL so:

Select to_char( (sysdate + 2/24), 'YYYY:MM:DD, HH24:MM' ) NEW_DATE FROM DUAL NEW_DATE



2000:02:23, 19:02

Select to_char( (sysdate + 20/24), 'YYYY:MM:DD, HH24:MM' ) NEW_DATE FROM DUAL NEW_DATE



2000:02:24, 13:02

Any other ideas?

Argosy

In article <891lkn$gn6$1_at_nnrp1.deja.com>,   argosy22_at_my-deja.com wrote:
> Hello all,
>
> We have a new spec, and it's got a good skill
> testing question in it. We are using Oracle 7.3.4.
>
> We have a date field, and a number field.
> The number field indicates a number of hours.
>
> We need to combine these two to get a new date.
> (date + hours = new_date). (That date will then
> be compared to another date.)
>
> I've looked at the built in Oracle functions.
> There is the add_months() and next_day() functions.
> But that is not what I'm looking for.
>
> this gives:
>
> Select to_char(sysdate, 'DDD:HH24') Doy_hoD
> FROM DUAL
>
> DOY_HOD
> --------------
> 054:16
>
> Is there a way to add these two fields together
> into a date in a simple manner? Or, do you think
> that I will have to write a complex function to do this?
>
> Thanks,
>
> Argosy
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Feb 23 2000 - 16:24:32 CST

Original text of this message

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