Вниз
Скачать: CL | DM;

Как определить сколько дней в заданном месяце   Найти похожие ветки 

 
Igor_ ©   (2002-02-25 12:50) [0]

Как определить сколько дней в заданном месяце


 
VictorT   (2002-02-25 13:00) [1]

Вроде уже недавно было, но всё-таки:

int DaysPerMonth(unsigned short year, unsigned short month)
{
++month;
if (month == 13) {
month = 1;
++year;
}
TDateTime dt = EncodeDate(year, month, 1);
--dt;
unsigned short days;
dt.DecodeDate(&year, &month, &days);
return days;
}


 
Woron ©   (2002-02-25 13:17) [2]

from help

function DaysInAMonth(const AYear, AMonth: Word): Word;

Description

Call DaysInAMonth to obtain the number of days in the specified month of the specified year.

AYear is a year between 1 and 9999 (inclusive).

AMonth is a month between 1 and 12 (inclusive).


 
Woron ©   (2002-02-25 13:18) [3]

и посмотри еще date/time routines
много интересного найдешь


 
Igor_ ©   (2002-02-25 13:26) [4]

To Woron:
Какой модуль надо указать в Uses


 
MrBeer ©   (2002-02-25 17:24) [5]

// (c) RxLib
function LeapYear(year: integer): boolean;
begin
Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
end;
Function GetDaysInMonth(year,month:integer):integer;
const
DaysInMonth: array[1..12] of Integer =
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
Result := DaysInMonth[Month];
if (Month = 2) and LeapYear(Year) then Inc(Result); { leap-year Feb is special }

end;



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

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.007 c
14-32569
ev
2002-01-26 14:11
2002.03.11
Операционная система


6-32532
Dok_3D
2001-12-24 08:04
2002.03.11
COM+


7-32596
VEG
2001-11-19 16:41
2002.03.11
Крупный шрифт


3-32392
Nest
2002-02-12 11:26
2002.03.11
Надо сформировать запрос (Select). Мыслб крутится, но не могу ухвтить - помогите пожалуйста. Очень пожалуйста.


7-32587
wHammer
2001-11-30 13:05
2002.03.11
Speaker




   Наверх