0

I'm having a hard time of searching about retrieving/getting server time without using GET DATE(). My previous application, I used GET DATE() and it works but when it is installed in local pc(multiple users) the get date is not the same just like the other PC. Then I search about netapi32.dll from other forum sites (Here!) it does work in local pc and other pc not running OS SERVER but in getting server time with OS SERVER installed its no luck.

BTW, this is a WinForm Application.

Any ideas or alternatives is much appreciated.

Thank you in Advance.

rayncorg
  • 963
  • 4
  • 16
  • 33
  • Why do you need the db server date? – Matt Wilko Mar 05 '14 at 09:14
  • oh actually, I want to get the date/time of server pc. My application is like DTR. – rayncorg Mar 05 '14 at 09:20
  • My question really is why do you need this? – Matt Wilko Mar 05 '14 at 09:53
  • I'm guessing that when running on local PC's the times are different (probably because they don't get their time from a central source... or local users can change their PC time). Originator wants to get the time from a single source. – Mych Mar 05 '14 at 10:47
  • @Unknownymous is your app saving information to a central database? If so you could get the DB server to set time in Updates and Inserts – Mych Mar 05 '14 at 10:48

1 Answers1

0

If you need a consistant time without using a server, the only think I can suggest is using an Internet Time Server. I would not sugest you query the server everytime you need the time but just query it once, at startup, and track the offset from the local computers' time.

Here is some information on getting the Internet time if you like: Sync Internet Time with Computer

Community
  • 1
  • 1
Steve
  • 5,585
  • 2
  • 18
  • 32