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

Home -> Community -> Usenet -> c.d.o.tools -> Re: working with time calculations...

Re: working with time calculations...

From: greenie-trainee-deebeeyay <xxx_at_hotmail.com>
Date: Wed, 25 Jul 2001 01:43:34 +1200
Message-ID: <isg77.13309$a04.45809@newsfeeds.bigpond.com>

Thanks guys... but just to push my luck...

I'm now having trouble calculating the difference between the two times. months_between gives a zero value because both date values are on the same day.
is there a similar fucntion for time (i.e hours_between).

Alternatively if someon could think of an eaier approach, I love to hear it. Thanks again

Peet

Greg Murphy <greg.murphy_at_bt.com> wrote in message news:9jk2gv$p7c$1_at_pheidippides.axion.bt.co.uk...
> Peet
>
> Assuming the fields in your table are of DATE datatype, use the following:
>
> insert into timesheet
> values (to_date('24-JUL-2001 05:57:00', 'DD-MON-YYYY HH24:MI:SS'),
> to_date('24-JUL-2001 09:05:00', 'DD-MON-YYYY HH24:MI:SS'))
>
> which tells the insert statement to convert the text string against the
 date
> map specified. Alternately, set the NLS_DATE_FORMAT to default to the
 format
> map that you want to use.
>
>
> "Trainee DBA" <xxx_at_hotmail.com> wrote in message
> news:HRe77.13237$a04.45753_at_newsfeeds.bigpond.com...
> > I'm trying to build a simple time keeping application... I'm stuck on
 basic
> > calculations with time.
> > I have created a table with 2 date fields, where i want to insert start
 and
> > stop times.
> > Later I want to build a view that subtract one from the other and
 calculate
> > the time in hours and minutes.
> >
> > My attempt so far of:
> >
> > insert into timesheet
> > values ('24-JUL-2001 05:57:00', '24-JUL-2001 09:5:00')
> >
> > Doesn't seem to work... I get the error:
> >
> > ERROR at line 2:
> > ORA-01830: date format picture ends before converting entire input
 string
> >
> > The SQLA course covers arithmetic with dates, which I 'm happy enough
> > with... but how do you enter a specific date + time into a date field?
> >
> > If anybody could offer some help or a better way of doing this Id really
> > appreciate the help. Thanks
> >
> >
> > Peet
> >
> >
>
>
Received on Tue Jul 24 2001 - 08:43:34 CDT

Original text of this message

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