IncYear、IncMonth、IncWeek、IncDay、IncHour、IncMinute、IncSecond、IncMilliSecond - 增时
    
        
        
DateUtils.IncYear();
DateUtils.IncMonth();
DateUtils.IncWeek();
DateUtils            
                
                    
                        
                                                            
                                                                        
                                                                                        原创
                                                                                    
                            2021-04-30 23:07:11
                            
                                608阅读
                            
                                                                             
                 
                
                             
         
            
            
            
            Delphi里有现成的函数可以实现日期加减,是在DateUtils单元里的。
 
function IncYear(const AValue: TDateTime;
const ANumberOfYears: Integer = 1): TDateTime;
// function IncMonth is in SysUtils
function IncWeek(const AValue: TDa            
                
         
            
            
            
            年份增加1:uses DateUtils;
 procedure TForm1.Button3Click(Sender: TObject);
 var
   a,b:TDateTime;
 begin
   a:=StrToDateTime(Label2.Caption);
   b:=IncYear(a);
   ShowMessage(DateTimeToStr(b));
 end;日期时间差            
                
                    
                        
                                                            
                                                                        
                                                                                        转载
                                                                                    
                            2024-04-10 05:50:40
                            
                                386阅读