怎么样获得系统当前月份,以及日期怎么加一个月份

解决方案 »

  1.   

    DecodeDate(Now, Year, Month, Day)
    Month 就是当前的月份
    IncMonth(TDateTime,1)表示在TDateTime的时间上加一个月
      

  2.   

    var
      Year, Month, Day:word;
    .....
      DecodeDate(Date, Year, Month, Day)
      Month 就是当前月份
      IncMonth(TDateTime,1)表示加一个月
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Present: TDateTime;
      Year, Month, Day: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      edit1.Text := inttostr(Month);
      label1.Caption := datetimetostr(IncMonth(Present,1));
     end;
      

  4.   

    Var Str_Month,STr_YearMonth:string;
      Str_month:=FormatDatetime('mm',date);  //只月份
      Str_YearMonth:=Formatdatetime('YYYY-MM',date);//年加月Formatdatetime这个函数你可以具体的查一下帮助,挺好用的。
      

  5.   

    var
      Year, Month, Day:word;
    .....
     用 DecodeDate(now, Year, Month, Day)或
    加一个月用 IncMonth(TDateTime,1)
      

  6.   

    GetSystemDate()
    SetSystemDate(m);
    你看一下帮助就可以了!
      

  7.   

    首先设变量来取系统时间
    var
    systemtime:Tsystemtime;
    然后可以直接操作,显示
    edit1.Text:= inttostr(systemtime.wMonth);
    //加上一个月
    self.Edit2.Text:= inttostr((systemtime.wMonth+1));