比如有一日期:20040605,怎样运算得到得到下一日20040606?还要考虑到特殊情况,如:20040630,下一日应是20040701,谢谢指教!

解决方案 »

  1.   

    Returns a date shifted by a specified number of days.UnitDateUtilsCategorydatetime routinesDelphi syntax:function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime;C++ syntax:extern PACKAGE System::TDateTime __fastcall IncDay(const System::TDateTime AValue, const int ANumberOfDays = 0x1);DescriptionIncDay returns the value of the AValue parameter, incremented by ANumberOfDays days. ANumberOfDays can be negative, to return a date N days previous.The time of day specified by the AValue parameter is copied to the result.
    ------------------------------------
    体验速度,体验CSDN新版论坛助手:http://community.csdn.net/Expert/TopicView.asp?id=3108679
      

  2.   

    function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime;
      

  3.   

    function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime;
      

  4.   

    //月初
    function BOFM(Date1:TDateTime):TDateTime;
    var
    Year1,Month1,Day1:Word;
    begin
      DecodeDate(Date1,Year1,Month1,Day1);
      Result := EncodeDate(Year1,Month1,1);
    end;//月末
    function EOFM(Date1:TDateTime):TDateTime;
    var
    Year1,Month1,Day1:word;
    begin
      DecodeDate(Date1, Year1, Month1, Day1);
      Result := EncodeDate(Year1,Month1,DayOfTheMonth(Date1));
    end;
      

  5.   

    不用你自己做的,有函数IncDay
      

  6.   

    var
    t: TDate;
    begin
      t := t+1;
    end;