Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The problem of adding date to integer in delphi
The problem of adding date to integer in delphi
Decodedate(d 1, nn, yy, rr) decomposes the date first.

D 1: = code (NN+ 1, YY, RR) reorganization date, because there is no annual increase or decrease limit, it can be added or subtracted directly.

d 1:= d 1- 1; Then subtract 1 directly from the date.

If you want to add or subtract months, you must first judge the changes in the relevant years. If you want to add, you must first get the number of days in next month.

d 1:= d 1+(encoded ate(nn,yy+ 1,rr)-encodedate(nn,yy,RR));

If you subtract, you must first get the number of days in last month, and then subtract.

d 1:= d 1-(encoded ate(nn,yy,rr)-encodedate(nn,yy- 1,RR));