//你错了    label1.Caption := formatdatetime('dd', strtodate(s1) -
      strtodate(s));
//换成看看
    label1.Caption := format('%f', [strtodate(s1) - strtodate(s)]);//formatdatetime函数用错地方了

解决方案 »

  1.   

    //<TDate>减<TDate>得<Real>
    //不是<TDate>
    //知道了吧
      

  2.   

    label1.Caption := formatdatetime('dd', strtodate(s1) - strtodate(s) + 1.0 );
                                                                         ~~~~~  
      

  3.   

    var s, s1, s2: string;i, i1: integer;
       j,j1:Extended;
    begin
      i := strtoint(edit1.text);
      if i in [1..12] then begin
        i1 := i + 1;
        s := inttostr(i);
        s1 := inttostr(i1);
        if length(s) = 1 then s := '0' + s;
        if length(s1) = 1 then s1 := '0' + s1;
        s2 := formatdatetime('yyyy', date);
        s := s2 + '-' + s + '-01';
        if s1 = '13' then s1 := inttostr(strtoint(s2) + 1) + '-01-01'
        else s1 := s2 + '-' + s1 + '-01';
        j:=int(strtodate(s1));
        j1:=int(strtodate(s));
        label1.Caption :=floattostr(j-j1);
      end;
    试试这样!