获取系统的开机时间

API:
程序代码 程序代码

#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&" 秒 " )


第二种方法:

程序代码 程序代码


$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) & "毫秒" )


你可能感兴趣的:(职场,休闲,au3)