Subject Re: [firebird-support] Re: Hourly rate
Author Martijn Tonies
> > > > No, this isn't a "time", it's a "duration" or "interval".
> Something
> > > which
> > > > Firebird doesn't support.
> > > >
> > > Firebird supports mathmatic, it is enough.
> >
> > You can do maths on it, I know.
> >
> > But the "time" of 16:00 afternoon divided by 2 does
> > not give you a "time" value of 08:00 in the morning.
> > Let alone if you have the date of today at a certain
> > time.
>
> is it logical? why do you want to do with divide by 2 ?
> if you realy want to get half of time then you can
> convert the time into computable numeric format and...

Actually, dividing a TIME by 2 would give you an INTERVAL,
which is perfectly computable (if the type existed in Fb).

> cast('00:00' as time)+((mytime-cast('00:00' as time))/2)
>
> what does computers internally when you try to this:
> mytime + 60 // add a minute (60 seconds) to mytime

Ehm, my Firebird does not do this when I try :-)

> computer converts mytime to 10 based numbers.
>
> (hours*3600)+(minutes*60)+seconds + 60
>
> then rebuilds time from this number.
>
> if there was acceptable reasons for dividing time, developers could
> add it.

> > Another example:
> > Oct 21 15:00 (which is a "date and time") minus 2 hours
> > (which is NOT a time) gives you Oct 21, 13:00.
> >
> > See the "2 hours" part - that is a "duration", not a time.
> >
> > Now, remove 1.5 days. You'll get Oct 20, 03:00.
> >
> > But 1.5 days - how would you display that? No such thing
> > in a "date and time" format, is there?
>
> Again, TIME is not DATE.

No, but this is why I said that computations on TIME cannot
be done with a TIME format. For example, adding 10 hours
to 18:00 will give you 28 hours, which cannot be done in a
TIME datatype.

You can misuse the "datetime" format for this though.

I think we both agree, as long as the distinction between
time, date, datetime and intervals/duration are clear.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com