Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.09.29;
Скачать: CL | DM;

Вниз

Как прибавить к дате M месяцев?   Найти похожие ветки 

 
AL1000   (2003-09-18 09:17) [0]

Как прибавить к дате M месяцев?


 
Жёсткая логика ©   (2003-09-18 09:40) [1]

Функция IncMonth модуля SysUtils


 
app ©   (2003-09-18 09:50) [2]

Это конечно если устроит результат


 
Reindeer Moss Eater ©   (2003-09-18 09:53) [3]

31 января + 1 месяц это сколько должно получиться?


 
JohnJ ©   (2003-09-18 10:37) [4]

2 или 3 марта, в зависимости от года...


 
Reindeer Moss Eater ©   (2003-09-18 10:44) [5]

А по идее должно получаться 28 или 29 февраля в зависимости от года.


 
090909   (2003-09-18 10:48) [6]

procedure TAddKart.DBDateEdit1Change(Sender: TObject);
var
D, Dk, Dt, G, Gk, CH : integer;
DD : String;
begin
D:=0; Dk:=0; Dt:=0; G:=0; Gk:=0; CH:=0;
{d - текущий месяц
dk - конечный месяц
dt - разница
G - год
Gk - конечный}
D := RetDate(DBDateEdit1.Date,2);
G := RetDate(DBDateEdit1.Date,1);
CH := RetDate(DBDateEdit1.Date,3);
dk := d + 6;
if dk>12 then
begin
Dt := dk - 12;
gk := g + 1;
end
else
begin
gk := g;
Dt := dk;
end;

DD := Inttostr (DT)+"/"+Inttostr (CH)+"/"+Inttostr (GK);
DBDateEdit2.Date := VarToDateTime(dd);
end;


 
ZEE ©   (2003-09-18 10:48) [7]

из хелпа:
[code]function IncMonth(const Date: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
...
[b]If the input day of month is greater than the last day of the resulting month, the day is set to the [u]last day[/u] of the resulting month.[/b] The time of day specified by the Date parameter is copied to the result.[/code]
так что будет таки "28 или 29 февраля в зависимости от года"


 
ZEE ©   (2003-09-18 10:50) [8]

поправка с правильной расстановкой тегов :)
из хелпа:
function IncMonth(const Date: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
...
If the input day of month is greater than the last day of the resulting month, the day is set to the last day of the resulting month. The time of day specified by the Date parameter is copied to the result.

так что будет таки "28 или 29 февраля в зависимости от года"


 
Anatoly Podgoretsky ©   (2003-09-18 11:59) [9]

31 марта - 1 месяц
30 марта - 1 месяц
29 марта - 1 месяц
28 марта - 1 месяц
28 февраля - 1 месяц

И повторно вопрос от Reindeer Moss Eater © (18.09.03 09:53) [3], при том сначла вдуматься в вопрос, не сколько даст эта функция, а сколько должно получиться.



Страницы: 1 вся ветка

Текущий архив: 2003.09.29;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.034 c
1-96209
lex7
2003-09-18 09:33
2003.09.29
Копирование директории


1-96262
ShadowSmart
2003-09-17 11:36
2003.09.29
try except end


1-96297
npAKTuk
2003-09-16 14:24
2003.09.29
Расшифровка M3u


1-96171
servs
2003-09-15 18:33
2003.09.29
проблемы с СОМ под 9х


14-96432
jack128
2003-09-10 13:09
2003.09.29
Именинники 10 сентября