Jump to content
Xtreme .Net Talk

Date and Time Question


Recommended Posts

Guest scorpion53061
Posted
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.
Posted
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..

Regards,

Anis

Miles to go Before I Sleep.

Guest TheIrishCoder
Posted
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.
Guest scorpion53061
Posted

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.

Guest TheIrishCoder
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...