AHK,获取北京时间
MsgBox BeijingTime() /* AHK_H v2 版本1.1 修改部分错误 by king 2017.10.28 */ BeijingTime() { ; 获取 http 返回的头部信息 Http := ComObjCreate("WinHttp.WinHttpRequest.5.1") Http.Open("HEAD", "http://baidu.com", True) Http.Send() Http.WaitForResponse() str:=Http.GetResponseHeader("Date") RegexMatch(str,"\w+,\s*(\d+)\s*(\w+)\s*(\d+)\s*(\d+):(\d+):(\d+)",match) year:=match[3], month:=match[2], day:=match[1] ,minute:=match[5],second:=match[6] hour:=Format("{:02}",match[4]+8) Months :=["Jan","Feb","Mar","Apr","May","Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] for index,value in Months { if(value=month) { month:=Format("{:02}",index) break } } return year month day hour minute second }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
谢谢