如何得到前n年前的年份,比如我要的到前三年的年份为2002
之后在把它转换成字符型的,多谢

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      year:string;
      Iyear:Integer;
    begin
      ShortDateFormat:='yyyy';
      Iyear:=StrToInt((DateTimetostr((Date()))));
      year:=IntToStr(Iyear-3);
      ShowMessage(year);
    end;//日期函数参见http://www.b2ing.com/bolg/blogview.asp?logID=75&cateID=11
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShowMessage(IntToStr(StrToInt(FormatDataTime('yyyy', Now)) -3));
    nd;
      

  3.   

    问题解决,高手,哈哈
    晚上结帖
    不过konhon(优华) 把date成了data,一点小错误,瑕不掩瑜,佩服