Title: Changing system date and time in Windows
Question: How to set the system clock in Windows, changing the date and time.
Answer:
By using the following call (example is a method of a button click) you may directly modify the date and time of Windows.
procedure TForm1.Button1Click(Sender: TObject);
var
NewTime: TSystemTime;
begin
FillChar(NewTime, sizeof(NewTime), #0);
NewTime.wYear := 2000;
NewTime.wMonth := 8;
NewTime.wDay := 28;
NewTime.wHour := 0;
NewTime.wMinute := 0;
NewTime.wSecond := 0;
NewTime.wMilliseconds := 0;
SetLocalTime(NewTime);
end;