Submitted by prashant_agr on Sun, 2007-05-06 14:09.
ith the procedure SetDateTime you can set the date and time of the operating system, from within your Delphi application.
In the interface-section you define the procedure:
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
In the 'implementation' you write...:
{ SetDateTime sets the date and time of the operating system }
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
var
NewDateTime: TSystemTime;
begin
FillChar(NewDateTime, SizeOf(NewDateTime), #0);
NewDateTime.wYear := Year;
NewDateTime.wMonth := Month;
NewDateTime.wDay := Day;
NewDateTime.wHour := Hour;
NewDateTime.wMinute := Minu;
NewDateTime.wSecond := Sec;
NewDateTime.wMilliseconds := MSec;
SetLocalTime(NewDateTime);
end;
Re: How to set system date and time in Delphi ?
ith the procedure SetDateTime you can set the date and time of the operating system, from within your Delphi application.
In the interface-section you define the procedure:
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
In the 'implementation' you write...:
{ SetDateTime sets the date and time of the operating system }
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
var
NewDateTime: TSystemTime;
begin
FillChar(NewDateTime, SizeOf(NewDateTime), #0);
NewDateTime.wYear := Year;
NewDateTime.wMonth := Month;
NewDateTime.wDay := Day;
NewDateTime.wHour := Hour;
NewDateTime.wMinute := Minu;
NewDateTime.wSecond := Sec;
NewDateTime.wMilliseconds := MSec;
SetLocalTime(NewDateTime);
end;