How to compare Time with Integer?
Posted in 2000
Topics: General Discussion
How to compare Time with Integer?
I have an Integervalue which show me the seconds of a Day.
On the other side i have a Time ( hour to second).
How can i compare these values like :
Select * From X
Where ((time) as seconds) as Integer > Integervalue
or
Select * From X
Where time > ((Integervalue) as Time)
Can anyone recommend a good book to get?
Thanks for helping
Ernst Nuber
Ernst.Nuber@alcatel.de
> I have an Integervalue which show me the seconds of a Day.
> On the other side i have a Time ( hour to second).
> How can i compare these values like :
>
> Select * From X
> Where ((time) as seconds) as Integer > Integervalue>
> or
> Select * From X
> Where time > ((Integervalue) as Time)
Have you tried something like
select * from X where time > (Integervalue / 3600);
I'm not sure that it will work the way you want, but by deviding the
second of the day by 3600 will give you the number of hours.
--
# unrm /
ksh: unrm: not found
# man cpio
Sent via Deja.com http://www.deja.com/
Before you buy.
In article <38901595.B3DB11B8@alcatel.de>,
Ernst Nuber <Ernst.Nuber@alcatel.de> wrote:
> How to compare Time with Integer?
>
> I have an Integervalue which show me the seconds of a Day.
> On the other side i have a Time ( hour to second).
> How can i compare these values like :
>
> Select * From X
> Where ((time) as seconds) as Integer > Integervalue>
> or
> Select * From X
> Where time > ((Integervalue) as Time)>
> Can anyone recommend a good book to get?
>
> Thanks for helping
>
> Ernst Nuber
> Ernst.Nuber@alcatel.de
>
>
Ernst,
I'll start by stating the obvious; you can't compare seconds with
integers; they aren't the same things... I'm assuming that your integer
value is the number of seconds since a specific time, such as 00:00? If
so, you can use the interval time - 00:00 (which will return an
integer-like number hours, minutes and seconds).
Otherwise, what you'll have to do is figure out a function that converts
number of seconds into HH:MM.SS format. That shouldn't be too hard:
HH=Trunc(Number_of_Seconds/3600)
MM=Trunc((Number_of_Seconds - (HH * 3600))/60)
SS=Number_of_Seconds - HH*3600 - MM*60
HTH.
--
Dan Michaelis
Database Administrator
dan@kax.com
Sent via Deja.com http://www.deja.com/
Before you buy.