function ShortDate:string;
var s : array[0..255]of char;
begin
 GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nil, nil, s, SizeOf(s));
 Result:=s;
end;function LongDate:string;
var s : array[0..255]of char;
begin
 GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, nil, nil, s, SizeOf(s));
 Result:=s;
end;

解决方案 »

  1.   

    function ShortDate:string;
    var s : array[0..255]of char;
    begin
     GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nil, nil, s, SizeOf(s));
     Result:=s;
    end;function LongDate:string;
    var s : array[0..255]of char;
    begin
     GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, nil, nil, s, SizeOf(s));
     Result:=s;
    end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);begin
      Label1.Caption := DateTimeToStr(Now);end;
      

  3.   

    procedure TForm1.Timer1Timer(Sender: TObject);begin
      edit1.text := DateTimetoStr(Now);end;
      

  4.   

    var 
    lp:string;
    begin
    getsystemgime(lp);
    edit1.text:=inttostr(lp.wyear); //获得年
    edit2.text:=inttostr(lp.wmonth);//获得月
    eidt3.text:=inttostr(lp.wdat); //获得天数依此类推,可以得时间,到秒
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Self.Caption := 'Today is  ' + DateToStr(Date);
    end;