Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How we recognition Time Between 2 Time???

How we recognition Time Between 2 Time???

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    faravani
    wrote on last edited by
    #1

    Hi I Want recognition Time BetWeen 2 Time For Example: Now Time is 04:00:00 And My SourceCode is : if time>=23:15:00 and Time<=07:15:00 Then Msgbox "ok" End if But 04:00:00 Not Greater Than 23:15:00 And My code Failed Please Help Me

    C I 2 Replies Last reply
    0
    • F faravani

      Hi I Want recognition Time BetWeen 2 Time For Example: Now Time is 04:00:00 And My SourceCode is : if time>=23:15:00 and Time<=07:15:00 Then Msgbox "ok" End if But 04:00:00 Not Greater Than 23:15:00 And My code Failed Please Help Me

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Subtract the time from DateTime.Now, to know how much time has ellapsed, in the form of a TimeSpan. I don't see how this code would compile, is that really your code ? What is time, is it a string ? If it's a string, you've lost half the battle.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • F faravani

        Hi I Want recognition Time BetWeen 2 Time For Example: Now Time is 04:00:00 And My SourceCode is : if time>=23:15:00 and Time<=07:15:00 Then Msgbox "ok" End if But 04:00:00 Not Greater Than 23:15:00 And My code Failed Please Help Me

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #3

        you can use datediff also but timespan is better option depends on the your desired results try to look at cheat sheets also just for a quick reference , u can also Google cheat sheets here is one of the reference http://www.addedbytes.com/cheat-sheets/sql-server-cheat-sheet[^]

            T = DateDiff("n", (T1), (T2))
            T = TimeSpan.Compare(t1, t2)
        

        Best Of Regards, SOFTDEV Sad like books with torn pages, sad like unfinished stories ...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups