From: Jack B. Pollack on
Using VB 6 I want to compare two times, a time stamp and the current time.
The timestamp will always be on the same date as the current date so I dont
have to compare the date part (but can if it is easier)

I can break the time apart and use datepart() but there has to be a simpler
way.

eg: if time-timestamp < 5 min then ...

tia


From: Jack B. Pollack on
That subject should read "compare two times"
(dont post before second cup of cofee!!)

"Jack B. Pollack" <N(a)NE.nothing> wrote in message
news:erP8dpFFLHA.1272(a)TK2MSFTNGP05.phx.gbl...
> Using VB 6 I want to compare two times, a time stamp and the current time.
> The timestamp will always be on the same date as the current date so I
> dont
> have to compare the date part (but can if it is easier)
>
> I can break the time apart and use datepart() but there has to be a
> simpler way.
>
> eg: if time-timestamp < 5 min then ...
>
> tia
>


From: Norm Cook on
"Jack B. Pollack" <N(a)NE.nothing> wrote in message
news:erP8dpFFLHA.1272(a)TK2MSFTNGP05.phx.gbl...
> Using VB 6 I want to compare two times, a time stamp and the current time.
> The timestamp will always be on the same date as the current date so I
> dont
> have to compare the date part (but can if it is easier)
>
> I can break the time apart and use datepart() but there has to be a
> simpler way.
>
> eg: if time-timestamp < 5 min then ...
>
> tia

Look up DateDiff()


From: Mike Williams on
"Jack B. Pollack" <N(a)NE.nothing> wrote in message
news:erP8dpFFLHA.1272(a)TK2MSFTNGP05.phx.gbl...

> Using VB 6 I want to compare two times
> eg: if time-timestamp < 5 min then ...

Have a look at the DateDiff function, for example:

If DateDiff("n", d1, d2) >= 5 Then

The above will only bother with whole minutes, so if you want it to resolve
in seconds then you could instead use:

If DateDiff("s", d1, d2) >= 300 Then

Mike



From: Jack B. Pollack on
thanks


"Mike Williams" <Mike(a)WhiskyAndCoke.com> wrote in message
news:i0275j$f07$1(a)speranza.aioe.org...
> "Jack B. Pollack" <N(a)NE.nothing> wrote in message
> news:erP8dpFFLHA.1272(a)TK2MSFTNGP05.phx.gbl...
>
>> Using VB 6 I want to compare two times
>> eg: if time-timestamp < 5 min then ...
>
> Have a look at the DateDiff function, for example:
>
> If DateDiff("n", d1, d2) >= 5 Then
>
> The above will only bother with whole minutes, so if you want it to
> resolve in seconds then you could instead use:
>
> If DateDiff("s", d1, d2) >= 300 Then
>
> Mike
>
>
>