例程 Option Explicit Private 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 Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime _ As SYSTEMTIME) As Long Private Sub Form_Load() Dim lReturn As Long Dim lpSystemTime As SYSTEMTIME lpSystemTime.wYear = 1996 lpSystemTime.wMonth = 6 lpSystemTime.wDayOfWeek = 5 lpSystemTime.wDay = 28 lpSystemTime.wHour = 9 lpSystemTime.wMinute = 42 lpSystemTime.wSecond = 0 lpSystemTime.wMilliseconds = 0 lReturn = SetSystemTime(lpSystemTime) End Sub
Time 语句 设置系统时间。语法Time = time必要的 time 参数,可以是任何能够表示时刻的数值表达式、字符串表达式或它们的组合。说明如果 time 是一字符串,则 Time 会试着根据系统指定的时间,利用时间分隔符将其转换成一个时间。如果无法转换成一个有效的时间,则会导致错误发生。Date 语句 设置当前系统日期。语法Date = date对于运行 Microsoft Windows 95 的系统,要设置的 date 必须介于 1980 年 1月 1 日与 2099 年 12 月 31 日之间。对于运行 Microsoft Windows NT 的系统,date 必须介于公元 1980 年 1 月 1 日到 2079 年 12 月 31 日之间。
好象直接给date函数赋值就可以了 (我还没试过哦)
Private Sub Command1_Click()Date = "1999-9-9" Time = "13:13:13"End Sub 很危险的,运行了就要往回改。
Option Explicit Private 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 Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime _
As SYSTEMTIME) As Long Private Sub Form_Load()
Dim lReturn As Long
Dim lpSystemTime As SYSTEMTIME
lpSystemTime.wYear = 1996
lpSystemTime.wMonth = 6
lpSystemTime.wDayOfWeek = 5
lpSystemTime.wDay = 28
lpSystemTime.wHour = 9
lpSystemTime.wMinute = 42
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0
lReturn = SetSystemTime(lpSystemTime)
End Sub
设置系统时间。语法Time = time必要的 time 参数,可以是任何能够表示时刻的数值表达式、字符串表达式或它们的组合。说明如果 time 是一字符串,则 Time 会试着根据系统指定的时间,利用时间分隔符将其转换成一个时间。如果无法转换成一个有效的时间,则会导致错误发生。Date 语句
设置当前系统日期。语法Date = date对于运行 Microsoft Windows 95 的系统,要设置的 date 必须介于 1980 年 1月 1 日与 2099 年 12 月 31 日之间。对于运行 Microsoft Windows NT 的系统,date 必须介于公元 1980 年 1 月 1 日到 2079 年 12 月 31 日之间。
(我还没试过哦)
Time = "13:13:13"End Sub
很危险的,运行了就要往回改。