Elec0 Expert Cheater
Reputation: 0
Joined: 21 Nov 2007 Posts: 188 Location: Out of my mind, back in five minutes.
|
Posted: Mon Mar 10, 2008 7:36 am Post subject: [VB6]Current System Time/Date |
|
|
This feature is awesome. With this you can get the time on your computer, and the date.
Tutorial Difficulty: 1 (CopyPaste)
Level: 5/5 Advanced
Okay, this is a very simple tutorial, but very nice.
Let's create a timer and a command button, and a label. Just leave the names as they are and change the timer's properties to Enabled = false interval= 100 (you can do 1000 if you want.)
Now add this code in the command button:
Code:
| Code: |
Shell ("net time //server_name /set /y")
Timer1.Enabled = True
|
I have no idea what the shell command does, but it work. The second line makes the timer enabled.
Then add this in the timer.
| Code: |
Label1.Caption = FormatDateTime(Now, vbLongTime) + vbNewLine + FormatDateTime(Now, vbShortDate)
|
You don't have to have the VbNewLine, but I did.
Now when you click on the button, it will keep track of the time, and date.
I love google.
----
Now that you have learned the hard way, here is the easy way:
| Code: |
Call Msgbox(Now & " " & Time & " " & Date)
|
Will display the date and time, then the time then the date.
Thanks to Rezeyu for that (who you guys don't know.)
~Elec0 _________________
|
|