March 9, 2021
Hot Topics:

Getting the Internet Time

  • By Karl Moore
  • Send Email »
  • More Articles »

We recently ran this little-known piece of code as a tip here on VB-World but here it is again in full Technicolor glory two functions allowing you to set your computer clock in code.

Public Sub SetDate(NewDate As Variant)    On Error Resume Next    DateTime.Date = NewDateEnd SubPublic Sub SetTime(NewTime As Variant)    On Error Resume Next    DateTime.Time = NewTimeEnd Sub

And that really is all. You know how to grab the data from time servers, you know how to change it into a real date and you now know how to set the computer clock. Und das ist alles, mon ami!

Page 5 of 6

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date