Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Question
A copy of this was sent to "dicaprio" <dicaprio_at_tin.it>
(if that email address didn't require changing)
On 14 Apr 1998 14:31:41 GMT, you wrote:
>Hi,
>
>I have got this problem : I must subtract a date_variable from another ;
>e.g. I want to subtract one hour 1:00 from SYSDATE
>
> Select (SYSDATE-TO_DATE('1:00','hh24:mi') from dual ;
>
>and the OUT is a wrong result.
>Thanks in advance
>
>Veramente Grato
> Clemente di Caprio
>
>
>dicaprio_at_tin.it
Date Arithemtic is fairly straigh forward. If you subtract 1 from a date, you get the day before. Subtract 1/24 you get the previous hour. And so on. So, you want to:
select sysdate - 1/24 from dual;
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Apr 14 1998 - 09:55:29 CDT
![]() |
![]() |