time expressions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj

    #1

    time expressions

    How do I say 1 hour in VB.Net.

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

    If Now().Subtract( starttime).ToSt ring > ???????? Then
  • Cor Ligthert [MVP]

    #2
    Re: time expressions

    cj.

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

    I hope this helps,

    Cor

    "cj" <cj@nospam.nosp am> schreef in bericht
    news:ePU%23ygRS GHA.5728@tk2msf tngp13.phx.gbl. ..[color=blue]
    > How do I say 1 hour in VB.Net.
    >
    > I'm trying to find out if now - starttime > 1 hour
    >
    > If Now().Subtract( starttime).ToSt ring > ???????? Then[/color]


    Comment

    • AlanT

      #3
      Re: time expressions



      dim ts as TimeSpan = DateTime.Now.Su btract(startTim e)

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


      hth,
      Alan.

      Comment

      • cj

        #4
        Re: time expressions

        Thanks!

        AlanT wrote:[color=blue]
        >
        > dim ts as TimeSpan = DateTime.Now.Su btract(startTim e)
        >
        > if (ts.Hours >0) then
        > Trace.WriteLine ("More than an hour has passed since " &
        > startTime.ToStr ing())
        > end if
        >
        >
        > hth,
        > Alan.
        >[/color]

        Comment

        • cj

          #5
          Re: time expressions

          Thanks!

          Cor Ligthert [MVP] wrote:[color=blue]
          > cj.
          >
          > If now.addhours(-1).ToTicks > Starttime.ToTic ks then
          >
          > I hope this helps,
          >
          > Cor
          >
          > "cj" <cj@nospam.nosp am> schreef in bericht
          > news:ePU%23ygRS GHA.5728@tk2msf tngp13.phx.gbl. ..[color=green]
          >> How do I say 1 hour in VB.Net.
          >>
          >> I'm trying to find out if now - starttime > 1 hour
          >>
          >> If Now().Subtract( starttime).ToSt ring > ???????? Then[/color]
          >
          >[/color]

          Comment

          Working...