Главная страница
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.025 c
1-96215
Серж
2003-09-08 22:15
2003.09.29
компонент ActiveX F1Book для Delphi 6,7


8-96305
zumozzz
2003-06-04 07:22
2003.09.29
Язык


1-96222
ev
2003-09-15 20:05
2003.09.29
самостоятельная прорисовка TListView


3-96106
Vitaliygavrilov
2003-09-09 12:55
2003.09.29
Как правильно сделать поиск


1-96251
Armageddon
2003-09-17 15:56
2003.09.29
распознавания текста