Главная страница
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.029 c
14-96418
LiLa Ananda
2003-09-06 10:17
2003.09.29
---|Ветка была без названия|---


1-96277
promelectronika
2003-09-10 15:02
2003.09.29
Как переписать код на Си в делфи? заранее благодарен


14-96385
IronHawk
2003-09-11 16:12
2003.09.29
Напомните пожалуйста линк, недавно тут пролетал...


1-96179
qwerty2
2003-09-16 10:34
2003.09.29
PSafeArray и OleAutomation


1-96250
kalliopiy
2003-09-17 14:55
2003.09.29
ListView+TreeView