09-23-2012, 10:02 AM
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.
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.");
System.out.println("I prefer Java.");