是API的吗???
DELHPI的帮助里,没有这个函数呀!如果是,要加哪个单元呢??

解决方案 »

  1.   

    如果用,function SetLocalTime(Value: TDateTime): boolean;的话,你必须用
    uses IdGlobal;
    最好不用这个。推荐用一下的系统函数
    procedure TForm1.Button1Click(Sender: TObject);
    var ST:TSystemTime;
    begin
            ST.wYear:=2001;
            ST.wMonth:=1
            ST.wDay:=8
            SetSystemTime(ST);//当然,ST还有具体的时间属性可以设,可以精确到毫秒。
    end;
      

  2.   

    var SystemTime:TSystemTime;sdatetime:TDateTime;
    begin
     sdatetime:= 
     DateTimeToSystemTime(sdatetime,SystemTime);
     SetLocalTime(SystemTime);
    end;
      

  3.   

    TO:CH81(missile)
    我试了你的方法,没有任何作用呀??并没有改到系统日期!
      

  4.   

    var time:tsystemtime;
    begin
    time.wYear:=1999;
    time.wMonth:=12;
    time.wDay:=23;
    setlocaltime(time);
    SendMessage(HWND_BROADCAST,WM_TIMECHANGE,0,0) ;
    end;
    试试
      

  5.   

    zhyd(笨鸟):你得吧st结构全填全就行了。而且你在nt下要有最高权限。
    procedure TForm1.Button1Click(Sender: TObject);
    var ST:TSystemTime;
    begin
            St.wYear:=2000;
            St.wMonth:=8;
            St.wDay:=17;
            St.wDayOfWeek:=5;
            St.wHour:=17;
            St.wMinute:=21;
            St.wSecond:=31;
            St.wMilliseconds:=2;
            if SetSystemTime(ST)=False then
            begin
                    ShowMessage(Inttostr(GetLastError));
            end;
    end;
      

  6.   

    var SystemTime:TSystemTime;sdatetime:TDateTime;
    begin
      sdatetime:=strtodatetime(yourtimestring);
      DateTimeToSystemTime(sdatetime,SystemTime);
      SetLocalTime(SystemTime);
    end;