Thread: time comparing

time comparing

From
Remigiusz Sokolowski
Date:
hi!
I need to compare two values of time.
One of them is just value of field - I want to compare it to value of
now() less 1 hour - shortly I want to select all records which are older
then 1 hour - how to do that?
    TIA
    Rem

-------------------------------------------------------------------*------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *
-----------------------------------------------------------------*****----------


Re: [SQL] time comparing

From
Patrik Kudo
Date:
Remigiusz Sokolowski wrote:
>
> hi!
> I need to compare two values of time.
> One of them is just value of field - I want to compare it to value of
> now() less 1 hour - shortly I want to select all records which are older
> then 1 hour - how to do that?

Ah! This reminds me! I've been wondering about a similar problem. How do
I
exchange that 1 hour with one week or one month? Probably the same way
as
with one hour (if there is any easy way)...

Regards,
Patrik Kudo

Re: [SQL] time comparing

From
Remigiusz Sokolowski
Date:
> > hi!
> > I need to compare two values of time.
> > One of them is just value of field - I want to compare it to value of
> > now() less 1 hour - shortly I want to select all records which are older
> > then 1 hour - how to do that?
>
> Ah! This reminds me! I've been wondering about a similar problem. How do
> I
> exchange that 1 hour with one week or one month? Probably the same way
> as
> with one hour (if there is any easy way)...

hi!
I just solve this
there is function age()
I do that this way
age(datetime(my_timestamp_fld),datetime(now())) > 3600::timespan

But I'm still wonder if all function are write for datetime type.
I thought that timestamp is hmmm... some kind of basic internal
representation of time, so search for such function for type timestamp - I
have 6.3.2 ver. May be in newer version there are already functions for
timestamp type?
    Rem
-------------------------------------------------------------------*------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *
-----------------------------------------------------------------*****----------