• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 138
  • Last Modified:

System clock change in NT

Can I create a VB application that can change the NT Server's system clock? What is the API to do this?
0
Barkley
Asked:
Barkley
1 Solution
 
EDDYKTCommented:
' Set local system clock
Time = Format(Tdate, "ttttt")
Date = Format(Tdate, "ddddd")

where Tdate is defined as Date
0
 
hesCommented:
In a module:

Public Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type
Public Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

In the code:

Dim ST As SYSTEMTIME

GetSystemTime ST
ST.wHour = ST.wHour +/- YourChanges
ST.wMinute = ST.wMinute +/- YourChanges
ST.wSecond = ST.wSecond +/- YourChanges
SetSystemTime ST
Note... ST.wHour is in GMT time not local time.  YourChanges is the difference you want to make
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now