How To Set the System Time (154009)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q154009 SUMMARY
The Win32 SetSystemTime API function offers the functionality to change the
system time on the local machine. The change will take place immediately
without the need for a reboot. This article illustrates how to create a
sample project that sets the system time using the SetSystemTime function. The SetSystemTime function sets the system time based on coordinated universal time (UTC). UTC-based time is loosely defined as the current date and time of day in Greenwich, England.
REFERENCES
The SYSTEMTIME Type structure is as follows:
WYear Integer-The current year.
WMonth Integer-The current month. January is 1.
WDayOfWeek Integer-The current day of the week. Sunday is 0.
WDay Integer-The current day of the month.
WHour Integer-The current hour.
wMinute Integer-The current minute.
wSecond Integer-The current second.
wMilliseconds Integer-The current millisecond.
To change the system time on a Win32 platform from 16-bit Visual Basic, you
would have to create a DLL that does a generic thunk to the 32-bit API
SetSystemTime.
Modification Type: | Minor | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbAPI kbhowto KB154009 |
---|
|