请问如何在windows下设置系统时间? 我也有同样问题,我用 SetSystemTime 都是不一样,总是相差 8 小时。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 系统取的时间是格林威志时间(GMT)中国时区(GMT+08:00)与格林威志时间相差8小时 在程序中 +8 即可 procedure TForm1.Button1Click(Sender: TObject);var tSetDate:TDateTime; vDateBias:Variant; tTZI:TTimeZoneInformation; tST:TSystemTime;begin gettimezoneinformation(tTZI); vDateBias:=tTZI.Bias/1440; tSetDate:=strtodatetime(E1.text+'-'+E2.text+'-'+E3.text+' '+ E4.text+':'+E5.text)+vDateBias;// E1-E2-E3 E4:E5//yyyy-mm-dd hh:mm with tST do begin wYear:=StrToInt(FormatDateTime('yyyy',tSetDate)); wMonth:=StrToInt(FormatDateTime('mm',tSetDate)); wDay:=StrToInt(FormatDateTime('dd',tSetDate)); wHour:=StrToInt(FormatDateTime('hh',tSetDate)); wMinute:=StrtoInt(FormatDateTime('nn',tSetDate)); wSecond:=0; wMilliseconds:=0; end; SetsystemTime(tST); close;end; 最简单的方法:var sstring:string;begin sString:='2001-05-21 16:30:49'; WinExec(pchar('Date '+Copy(sString,1,10)),SW_HIDE); WinExec(pchar('Date '+Copy(sString,12,8)),SW_HIDE);end;//不要笑我傻,这个绝对好用,另外kingsong(牛大锅) 的方法和系统设定是12显示还是24显示有关,不好用 SetLocalTime:设置本地时间SetSystemTime:设置格林时间 急啊,IdFTPServer总是出现内存错误 求用Delphi写Dll的方法。 MagicExport --- 非常强大而且实用的数据导出工具 在Delphi中怎样调用GOOGLE的API搜索歌曲并且使程序得到搜索歌曲的URL 請 fisheep_cn(笨鱼) 來領分! 多謝。 如何截断系统错误??? 您好,请教这个错误怎么处理? 谢谢 问题叫板 replacedialog 的问题,急啊! udp是怎么回事? QuickReport中的问题紧急求救,请各位大虾给予帮助 如何在安装程序中安装驱动程序
中国时区(GMT+08:00)与格林威志时间相差8小时 在程序中 +8 即可
var
tSetDate:TDateTime;
vDateBias:Variant;
tTZI:TTimeZoneInformation;
tST:TSystemTime;
begin
gettimezoneinformation(tTZI);
vDateBias:=tTZI.Bias/1440;
tSetDate:=strtodatetime(E1.text+'-'+E2.text+'-'+E3.text+' '+
E4.text+':'+E5.text)+vDateBias;
// E1-E2-E3 E4:E5
//yyyy-mm-dd hh:mm
with tST do
begin
wYear:=StrToInt(FormatDateTime('yyyy',tSetDate));
wMonth:=StrToInt(FormatDateTime('mm',tSetDate));
wDay:=StrToInt(FormatDateTime('dd',tSetDate));
wHour:=StrToInt(FormatDateTime('hh',tSetDate));
wMinute:=StrtoInt(FormatDateTime('nn',tSetDate));
wSecond:=0;
wMilliseconds:=0;
end;
SetsystemTime(tST);
close;
end;
var
sstring:string;
begin
sString:='2001-05-21 16:30:49';
WinExec(pchar('Date '+Copy(sString,1,10)),SW_HIDE);
WinExec(pchar('Date '+Copy(sString,12,8)),SW_HIDE);
end;
//不要笑我傻,这个绝对好用,另外kingsong(牛大锅) 的方法和系统设定是12显示还是24显示有关,不好用
SetSystemTime:设置格林时间