Date and Time Question

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

Guest
Is there a way I can code to make the time and date be read from a server on a network instead of the machine it is running on.
 
I don't think its possible, unless you have a Server Program running on server. And then as soon as client login, it request server for data & time, and server send it to client..
 
Could be a good model for a simple web service on the server that your app could call/consume for it's date and time.
 
Thank you!!
Could you give me a sample of what I might use to call/consume (code wise in the app) to get that date and time. I do have a web service on our server.
 
I meant a .net xml WebService using asp.net. So assuming you are saying this is what you have it can then be consumed from your client program with little difficulty. You could have a method on your WebService like so:-

<WebMethod()> Public Function ProvideDate() As Date
Return Now
End Function

With your WebService compiled and installed on your server you can proceed to create your client program.
In the client program you can reference the web service as a web reference.

Once it's referenced your code to get the date would be:-

Dim WS As New [ServerName].[WebServiceName()
Dim ServerDate as Date = WS.ProvideDate

All this assumes the server is a windows server with .net installed.
 
Back
Top