Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date, Time Form the Server in Windows 2000

Status
Not open for further replies.

MarKes

Programmer
May 3, 2001
18
0
0
ES
I dont know how to get the Date and Time from my server in Windows 2000 .
I am working with Visual Basic 6 and i nedd to know in each Terminal the true Datetime from the server to make all computers work at the same time.

thanks, Gracias, Obrigado, Arigato, Arrivederci
 
I'm not sure how to do this 100% programmatically, but you can do it by shelling out some DOS commands.

"net time \\servername" will return the time on the remote server.

"net time \\servername /set /yes" will just set the local clock to match the time on the remote server.

If you need to capture the returned information, you could redirect the output of the "net" command to a file, read the file with VB, and then delete the file.

I hope this helps out.
 
If the server has SQLServer on it, you can do in an ADO query:

[tab]SELECT GETDATE() as CurrentDate

adoRS("CurrentDate") will then have the date that the server knows about.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top