Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to change dates or times in a oracle date time field
I think he realizes that Daniel..the question is how to add time to a date
field..
Jim,
To do that you simply add an integer to the field....the integer represents
the number of DAYS..so,
SYSDATE + 3 will add three days to SYSDATE, SYSDATE - 3 subtracts three days etc...
To get hours, minutes, seconds etc you divide a day into it's components (24 hours in a day for instance) so,
SYSDATE + 1/24 adds an hour, SYSDATE + 1/24/60 adds a minute etc..
Therefore to add 8 minutes as in your example you would use SYSDATE + 8/24/60
I hope this helps,
Steve
"Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message
news:3D10A09E.15E98EE5_at_exesolutions.com...
> jim agans wrote:
>
> > hi I have a QUESTION ON HOW TO ADD time to a oracle date field.
> >
> > What I would like to do is this:
> >
> > I would like to add some minutes to a date-time field ...the field looks
like this
> > 27-MAY-1999 12:01:01 AM
> >
> > HOW DO ADD like 8 minutes to this value and update??
> >
> > thanks
> > jim agans
>
> A better question would be how to get rid of the time in a date field ...
because you
> can not. Time is always there.
>
> Go to any table with a date field and type the following:
>
> SELECT TO_CHAR(date_field_name, 'DD-MON-YYYY HH:MI:SS')
> FROM table_name;
>
> Daniel Morgan
>
Received on Wed Jun 19 2002 - 10:34:26 CDT