Sheryl M
May 16th, 2001, 09:18 PM
Hi! I just wanted to ask if there is a way to access the server date and time when you are in a client computer. Are there any existing function that I could use in order to do this? Thanks. Hope you can help me.
|
Click to See Complete Forum and Search --> : Server date and time Sheryl M May 16th, 2001, 09:18 PM Hi! I just wanted to ask if there is a way to access the server date and time when you are in a client computer. Are there any existing function that I could use in order to do this? Thanks. Hope you can help me. Aaron Young May 16th, 2001, 11:23 PM You could use the "NET TIME" DOS command by wrapping it in a batch file and using it through VB, i.e.option Explicit private Sub Command1_Click() Dim iFile as Integer Dim sResults as string iFile = FreeFile Open "C:\~Temp.bat" for Output as iFile print #iFile, "NET time " & txtServerName & " > C:\~Results.txt"; Close iFile If len(Dir("C:\~Results.txt")) then Kill "C:\~Results.txt" Caption = "Checking server """ & txtServerName & """..." Shell "C:\~Temp.bat", vbHide While len(Dir("C:\~Results.txt")) = 0 DoEvents Wend While FileLen("C:\~Results.txt") = 0 DoEvents Wend iFile = FreeFile Open "C:\~Results.txt" for input as iFile sResults = input(LOF(iFile), iFile) Close iFile If InStr(LCase(sResults), "incorrect") Or InStr(LCase(sResults), "error ") then Caption = "UnKnown." else sResults = mid(sResults, InStr(sResults, " is ") + 4) sResults = Left(sResults, InStr(sResults, vbCrLf) - 1) Caption = sResults End If End Sub Aaron Young Senior Programmer Analyst ajyoung@charter.net Certified AllExperts Expert: http://www.allexperts.com/displayExpert.asp?Expert=11884 Cimperiali May 17th, 2001, 02:14 AM It is great to read from you again! Best regards, Cesare Imperiali Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |