如何取得服务器所在的时区 我用TNMDayTime控件做一个时间校正的程序,可不知道如何取得服务器的时区,请各位帮忙告诉我,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以用NTRMTDTE.zip和ntremotedatetime控件,在www.vclxx.org有下载或执行下面的代码:winexec('NET TIME [\\computer | /WORKGROUP:wgname] [/SET] [/YES]', 2); 使用TNMDayTime如下: NMDayTime1.host:=edit1.text; NMDayTime1.port:=strtoint(edit2.text);// NMDayTime1.Connect;try temp:=trim(NMDayTime1.DayTimeStr); memo1.lines.add(temp);except raise exception.create('不能连接服务器!');end; NMDayTime1.Disconnect; 无聊,再给你一个:procedure TForm1.Button1Click(Sender: TObject);var a : TSYSTEMTIME; T:TDateTime; TimeStr:String;beginLabel1.Caption := NMDayTime1.DayTimeStr;TimeStr := copy(Label1.Caption,7,18);label1.caption := '标准格林威治:'+TimeStr;update();T:=(StrToDateTime(TimeStr));DateTimeToSystemTime(t,a);SetSystemTime(a);GetLocalTime(a);T:=SystemTimeToDateTime(a);Label2.Caption := '标准北京时间 :'+DateTimeToStr(t);end; 可以使用 GetTimeZoneInformation API 函数获得当前系统的区域设置的时区信息。 急!!!关于实现用Delphi查询Excel文件中的数据的问题 Installshield express 制作 delphi 安装盘 如何转换这个字符串. 各位兄弟--memo里面怎么输入特殊字符呀---急需 杀进程的问题! Delphi5开发人员指南》1087页的例子怎样用的? 请问怎么访问多个数据库!(高手请进,菜鸟莫来) delphi5与SQLServer2000的数据库编程c/s模式? Dispatch的汇编代码如何理解? 有没有人用过qrchart? 如何使程序暂停等待一个事件? 有关Fastreport的问题。。。
或执行下面的代码:
winexec('NET TIME [\\computer | /WORKGROUP:wgname] [/SET] [/YES]', 2);
NMDayTime1.port:=strtoint(edit2.text);
// NMDayTime1.Connect;
try
temp:=trim(NMDayTime1.DayTimeStr);
memo1.lines.add(temp);
except
raise exception.create('不能连接服务器!');
end;
NMDayTime1.Disconnect;
procedure TForm1.Button1Click(Sender: TObject);
var
a : TSYSTEMTIME;
T:TDateTime;
TimeStr:String;
begin
Label1.Caption := NMDayTime1.DayTimeStr;
TimeStr := copy(Label1.Caption,7,18);
label1.caption := '标准格林威治:'+TimeStr;
update();
T:=(StrToDateTime(TimeStr));
DateTimeToSystemTime(t,a);
SetSystemTime(a);
GetLocalTime(a);
T:=SystemTimeToDateTime(a);
Label2.Caption := '标准北京时间 :'+DateTimeToStr(t);
end;