- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 设置本地系统时间
function SetLocalSysTime(const newTime:TDateTime):Boolean; //设置本地系统时间
var
MyTime:TsystemTime;
begin
FillChar(MyTime,sizeof(MyTime),#0);
MyTime.wYear := StrToInt(FormatDateTime('yyyy', newTime));
MyTime.wMonth := StrToInt(FormatDateTime('mm', newTime));
MyTime.wDay := StrToInt(FormatDateTime('dd', newTime));
MyTime.wHour := StrToInt(FormatDateTime('hh', newTime));
MyTime.wMinute := StrToInt(FormatDateTime('nn', newTime));
MyTime.wSecond := StrToInt(FormatDateTime('ss', newTime));
Result := SetLocalTime(MyTime);
//Result := SetSystemTime(MyTime);
end;