delphi _获取Internet时间
unit GetInternetTime; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComObj, DateUtils; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public function GetInternetTime:string; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var InternetTime:string; begin InternetTime:=GetInternetTime; ShowMessage(InternetTime); end; function TForm1 .GetInternetTime:string; var XmlHttp: Variant; datetxt: string; DateLst: TStringList; mon: string; timeGMT, GetNetTime: TDateTime; s: string; begin XmlHttp := CreateOleObject('Microsoft.XMLHTTP'); XmlHttp.Open('Get', 'http://www.baidu.com/', False); XmlHttp.send; datetxt := XmlHttp.getResponseHeader('Date'); datetxt := Copy(datetxt, Pos(',', datetxt) + 1, 100); datetxt := StringReplace(datetxt, 'GMT', '', []); datetxt := Trim(datetxt);
文件列表
Internet时间.rar
(预估有个15文件)
Internet时间
InternetTime.dproj
4KB
InternetTime.exe
451KB
__history
Project1.dpr.~1~
253B
Project1.dpr.~2~
253B
InternetTime.dpr.~1~
250B
InternetTime.dpr
254B
InternetTime.res
5KB
InternetTime.identcache
241B
用户评论