|
CODE:
'**************************************************
'
' 功能: 重新設(shè)置系統(tǒng)時(shí)間
' 用法: SetTime "2008-4-26 22:53:48"
' 作者: andymark
' QQ : 42503577 ; Email: ewang11@163.com
' 備注:
'
'**************************************************
'設(shè)置當(dāng)前系統(tǒng)時(shí)間
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
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
'時(shí)區(qū)
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Public Sub SetTime(NewTime As String)
' 功能: 設(shè)置系統(tǒng)時(shí)間
Dim lpSystemTime As SYSTEMTIME '時(shí)間信息
Dim ZoneNum As Integer
ZoneNum = getZoneNum()
With lpSystemTime
.wYear = Year(NewTime)
.wMonth = Month(NewTime) + 1
.wDayOfWeek = -1
.wDay = Day(NewTime)
.wHour = Hour(NewTime) + ZoneNum
.wMinute = Minute(NewTime)
.wSecond = Second(NewTime)
.wMilliseconds = 0
End With
SetSystemTime lpSystemTime
End Sub
Private Function getZoneNum() As Integer
Dim lpSystemZone As TIME_ZONE_INFORMATION '時(shí)區(qū)信息
GetTimeZoneInformation lpSystemZone
getZoneNum = lpSystemZone.Bias / 60
End Function
|站長郵箱|小黑屋|手機(jī)版|Office中國/Access中國
( 粵ICP備10043721號(hào)-1 )
GMT+8, 2025-7-13 07:36 , Processed in 0.064568 second(s), 14 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.