how time is calculated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    how time is calculated

    Hi
    i am getting probleum in calculating time difference between two time values
    e.g.
    starttime =12:56:05 PM
    endtime = 1:16:29 AM //wrong value
    endtime=1:16:29 PM // correct value
    but when i insert the value in endtime variable it converts PM Into AM
    and i want the same value i,e endtime = 1:16:29 PM
    starttime and endtime have date datatype and default value in these variables have "12:00:00"
    please tell me the solution how can i solve this probleum

    varinder
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Try this :

    [code=vb]
    Dim StTime As Date
    Dim ETime As Date
    StTime = CDate("12:56:05 PM")
    ETime = CDate("1:16:29 PM ")
    MsgBox DateDiff("n", StTime, ETime)
    [/code]

    Regards
    Veena

    Comment

    • veer
      New Member
      • Jul 2007
      • 198

      #3
      Thanks Very Much
      it is working

      best regards
      varinder


      Originally posted by QVeen72
      Hi,

      Try this :

      [code=vb]
      Dim StTime As Date
      Dim ETime As Date
      StTime = CDate("12:56:05 PM")
      ETime = CDate("1:16:29 PM ")
      MsgBox DateDiff("n", StTime, ETime)
      [/code]

      Regards
      Veena

      Comment

      Working...