Home All Groups Group Topic Archive Search About
Author
16 Mar 2006 4:39 PM
cj
How do I say 1 hour in VB.Net.

I'm trying to find out if now - starttime > 1 hour

If Now().Subtract(starttime).ToString > ???????? Then

Author
16 Mar 2006 4:52 PM
Cor Ligthert [MVP]
cj.

If now.addhours(-1).ToTicks > Starttime.ToTicks then

I hope this helps,

Cor

Show quoteHide quote
"cj" <cj@nospam.nospam> schreef in bericht
news:ePU%23ygRSGHA.5728@tk2msftngp13.phx.gbl...
> How do I say 1 hour in VB.Net.
>
> I'm trying to find out if now - starttime > 1 hour
>
> If Now().Subtract(starttime).ToString > ???????? Then
Author
16 Mar 2006 6:02 PM
cj
Thanks!

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> cj.
>
> If now.addhours(-1).ToTicks > Starttime.ToTicks then
>
> I hope this helps,
>
> Cor
>
> "cj" <cj@nospam.nospam> schreef in bericht
> news:ePU%23ygRSGHA.5728@tk2msftngp13.phx.gbl...
>> How do I say 1 hour in VB.Net.
>>
>> I'm trying to find out if now - starttime > 1 hour
>>
>> If Now().Subtract(starttime).ToString > ???????? Then
>
>
Author
16 Mar 2006 4:56 PM
AlanT
dim ts as TimeSpan = DateTime.Now.Subtract(startTime)

if (ts.Hours >0) then
  Trace.WriteLine("More than an hour has passed since " &
startTime.ToString())
end if


hth,
Alan.
Author
16 Mar 2006 6:02 PM
cj
Thanks!

AlanT wrote:
Show quoteHide quote
>
> dim ts as TimeSpan = DateTime.Now.Subtract(startTime)
>
> if (ts.Hours >0) then
>   Trace.WriteLine("More than an hour has passed since " &
> startTime.ToString())
> end if
>
>
> hth,
> Alan.
>