Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
little help! working with system time
#2
Hello, jochen29.

What you want to do, in order to get full computer's time (without date), is declare four variables and set its values like this:
[code2=vbnet]hours = My.Computer.Clock.LocalTime.Hour ' Integer
minutes = My.Computer.Clock.LocalTime.Minute ' Integer
seconds = My.Computer.Clock.LocalTime.Second ' Integer
time = hours & ":" & minutes & ":" & seconds ' String[/code2]

If you want your hours, minutes and seconds to update as real time, add a new timer, set its interval to 1000 (1 second), enable it and set the values in timer's sub. It would look like this:
[code2=vbnet]Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
hours = My.Computer.Clock.LocalTime.Hour
minutes = My.Computer.Clock.LocalTime.Minute
seconds = My.Computer.Clock.LocalTime.Second
time = hours & ":" & minutes & ":" & seconds
End Sub[/code2]

Hopefully this solves your problem.
Also known as Rocketalypse.
System.out.println("I prefer Java.");


Messages In This Thread
Re: little help! working with system time - by Vinwarez - 09-23-2012, 10:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how do you make a register system in VB using Dropbox Cecilio 2 13,952 08-15-2013, 08:14 AM
Last Post: Cecilio
  DotNetBar not working... Please help. Ecnarf 0 6,272 02-12-2013, 08:18 PM
Last Post: Ecnarf
  Help w/ my new operating system Gamester699 5 20,274 07-24-2012, 12:50 PM
Last Post: Vinwarez
  making a windows login system Bradley 3 13,890 05-29-2012, 04:47 PM
Last Post: brandonio21
  Plugin System? zmanalpha 2 11,695 12-19-2011, 02:56 PM
Last Post: zmanalpha

Forum Jump:


Users browsing this thread: 1 Guest(s)