想写个时间到期截止使用的,以下是论坛找到的获取时间代码,增加了一个判断,目前判断就出现问题,明明是大于,却不执行else的部分,求解
GetWebTime()
Func GetWebTime();获取网络时间的函数
Local $www = Ping("www.baidu.com", 3000);
Local $httpbaidu = ObjCreate("WinHttp.WinHttpRequest.5.1")
$httpbaidu.Open("Get", "http://www.baidu.com", False);http://time.windows.com/? http://www.baidu.com/?
$httpbaidu.Send()
Local $baidutimeGMT = $httpbaidu.GetResponseHeader("Date")
Local $S = StringSplit("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",")
For $i = 1 To 12
$baidutimeGMT = StringReplace($baidutimeGMT, $S[$i], $i);返回格林尼治GMT时间,+8小时=北京时间
Next
$S = StringSplit($baidutimeGMT, ", :")
;local $tNew = _Date_Time_EncodeSystemTime($S[4],$S[3],$S[5],$S[6],$S[7],$S[8])
;5 4 3 6 7 8 中分别存放了 年月日时分秒
; $webtimeGMT=$S[5] &"/"& $S[4] &"/"& $S[3] &" "& $S[6] &":"& $S[7] &":"& $S[8]
; 年 月 日 时 分 秒
; MsgBox(0,"格林尼治时间是",$webtimeGMT)
$webtimeBeiJing = $S[5] & $S[4] & $S[3]
MsgBox(0, "北京时间是", $webtimeBeiJing)
;==>GetWebTime
; If $webtimeBeiJing <"20241007" Then
$ver="20241007"
If $webtimeBeiJing >= $ver Then
MsgBox(0, "提示", "时间大于")
Exit
Else
MsgBox(0, "提示", "时间小于")
EndIf
EndFunc ;==>GetWebTime
|