加一个月有incmonth函数,减一个月有没有decmonth函数哪?

解决方案 »

  1.   

    IncMonth 不行的, 第二个参数是常数
      

  2.   

    incyear,incmonth,incweek函数
    你把参数设置成incyear(tempdate,-1),incmonth(tempdate,-1),incweek(tempdate,-1)就可以了
    要use DateUtils单元
      

  3.   


      ShowMessage(DateTimeToStr(IncMonth(now,-1))) ;真还是对的 ! :) ,指定值的常数参数也可以替换 
      

  4.   

    showmessage(datetostr(incyear(now,-1)));//上年
    showmessage(datetostr(incmonth(now,-1)));//上月
      

  5.   

    function PreMonth(NowDate:TDateTime):Integer;
    var
      YY,MM,DD:word;
    begin
      DecodeDate(NowDate,yy,mm,dd);
      if MM>1 then MM:= MM-1 else MM:=12;
      result := MM;
    end;
      

  6.   

    的确好用,多谢CloneCenter(复制中心)