再给两个完整一点的例子吧$milliseconds = TimerDiff(0)
$years = Int($milliseconds / 31536000000)
$remainMS = Mod($milliseconds, 31536000000)
$days = Int($remainMS / 86400000)
$remainMS = Mod($milliseconds, 86400000)
$hours = Int($remainMS / 3600000)
$remainMS = Mod($milliseconds, 3600000)
$minutes = Int($remainMS / 60000)
$remainMS = Mod($milliseconds, 60000)
$seconds = Int($remainMS / 1000)
$remainMS = Mod($milliseconds, 1000)
MsgBox(0,"系统启动时间:",$years &"年" & $days & "天" & $hours& "小时" & $minutes & "分 " &$seconds & "秒" & Int($remainMS) & "毫秒" )
#Include <Date.au3>
$aTSB = DllCall ("kernel32.dll", "long", "GetTickCount")
$ticksSinceBoot = $aTSB[0]
dim $iHours, $iMins, $iSecs
_TicksToTime ( $ticksSinceBoot, $iHours, $iMins, $iSecs )
$iDays = int($iHours / 24)
$iHours = $iHours - ($iDays * 24)
msgbox(0,"系统启动时间:",$iDays&"天"&$iHours& "小时 "& $iMins &"分"& $iSecs&" 秒 " )
Sanhen 写的
至于启动时间,你获取系统时间再减去已启动的时间不就是开机时间了吗? |