解码一个系统时间到一个日期/时间字符串
#Include <Date.au3>
_Date_Time_SystemTimeToDateTimeStr(ByRef $tSystemTime [, $bFmt = 0])
$tSystemTime | $tagSYSTEMTIME 数据结构 |
$bFmt | [可选参数] 0 返回 mm/dd/yyyy hh:mm:ss (默认) 1 返回 yyyy/mm/dd hh:mm:ss |
#include <GUIConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>
Global $iMemo
_Main()
Func _Main()
Local $tTime
; 创建 GUI
GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; 显示系统日期/时间
$tTime = _Date_Time_GetSystemTime()
MemoWrite("System date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tTime))
MemoWrite("System date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tTime, 1))
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; 写入一行到 memo 控件
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite