By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

How to set a countdown and conduct a comparison of time in visual basic

P: 1
I currently have an app I am learning with. I design and redesign as I go. I am currently working with Time. The app currently has two timers that display current time local to client pc (As in not just my time) and UTC time.

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  3.         If ComboBox1.Text = "Local" Then
  4.             Clock1.ForeColor = Color.DimGray
  5.             Clock1.Value = Date.Now.ToString("HH:mm:ss")
  6.         ElseIf ComboBox1.Text = "Eve" Then
  7.             Clock1.ForeColor = Color.Black
  8.             Clock1.Value = Date.UtcNow.ToString("HH:mm:ss")
  9.         End If
  11.         If ComboBox2.Text = "Local" Then
  12.             Clock2.ForeColor = Color.DimGray
  13.             Clock2.Value = Date.Now.ToString("HH:mm:ss")
  14.         ElseIf ComboBox2.Text = "Eve" Then
  15.             Clock2.ForeColor = Color.Black
  16.             Clock2.Value = Date.UtcNow.ToString("HH:mm:ss")
  17.         End If
Both clocks are displayed in 24h format so HH:mm:ss.

Now I want to allow the user to input either a fixed time or a quantity of time ie( 4Hours or 4 o'clock ) I am thinking it is just a timer with some kind of a reverse tick or a subtraction going on. I am not finding anything on this subject on line. Can someone please point me in the correct direction and perhaps post some relevant links.

I Also need to be able to compare two times and find the difference between them. Can I just do this like a normal math problem or do I need to do something with the time first.


Mar 31 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.