title: Countdown timer in vb.net
body: <p>I'm having a start time as <code>11:30:25PM</code>  and an end time as <code>11:45:25AM</code></p>
  
  <p>So now I would like to get the diff between the end time and the start time</p>
  
  <p>This is what I have used the below code and working pretty well:</p>
  
  <pre><code>Dim dFrom As DateTime
  Dim dTo As DateTime
  Dim sDateFrom As String = Now.ToString("h:mm:ss tt")
  Dim sDateTo As String = txtlogout1.Text
  If DateTime.TryParse(sDateFrom, dFrom) AndAlso DateTime.TryParse(sDateTo, dTo) Then
      Timer1.Start()
      Dim TS As TimeSpan = dTo - dFrom
      Dim hour As Integer = TS.Hours
      Dim mins As Integer = TS.Minutes
      Dim secs As Integer = TS.Seconds
      Dim timeDiff As String = ((hour.ToString("00") &amp; ":") + mins.ToString("00") &amp; ":") + secs.ToString("00")
      txtremaining1.Text = timeDiff
  End If
  </code></pre>
  
  <p>Now the problem is if the start time is <code>11:30:25PM</code> and the end time is <code>12:00:25AM</code> then the remaining time is showing as <code>-23:30:00</code></p>
  
  <p>So what's the correct way of handling this?</p>