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 }
谢谢