Главная страница
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.536 c
1-96287
denis24
2003-09-16 10:52
2003.09.29
Управляющие коды принтера


1-96288
qwerty2
2003-09-16 13:21
2003.09.29
Глюки с QReport


3-96116
P0tia
2003-09-09 10:21
2003.09.29
Как узнать количество листов в Excel


14-96406
Val
2003-09-11 12:34
2003.09.29
Испорченным детям...


1-96293
McSimm2
2003-09-16 15:08
2003.09.29
Нажатость правой клавиши пиши