change system date

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2006
Posts: 1
Reputation: vjp is an unknown quantity at this point 
Solved Threads: 0
vjp vjp is offline Offline
Newbie Poster

change system date

 
0
  #1
Feb 4th, 2006
hello
Can anyone send me a link of a component that allows me to change system date or time? thanks.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 16
Reputation: Katrix36 is an unknown quantity at this point 
Solved Threads: 0
Katrix36 Katrix36 is offline Offline
Newbie Poster

Re: change system date

 
0
  #2
Apr 24th, 2006
Hey,

Heres some code to change the system time and date:

With 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;

Katrix36
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC