Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.03.11;
Скачать: 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 вся ветка

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

Наверх




Память: 0.47 MB
Время: 0.011 c
1-32508
kingdom
2002-02-25 13:24
2002.03.11
Как удалить директорию с поддиректориями


14-32553
Иван Шихалев
2002-01-08 19:59
2002.03.11
А не посоветует ли кто :)


14-32570
wicked
2002-01-28 13:44
2002.03.11
беспредел в Москве


1-32466
KiD
2002-02-21 19:03
2002.03.11
Как организовать вывод чисел по возрастанию(убыванию)?


3-32386
lexxvlad
2002-02-06 12:50
2002.03.11
Как пересоздать индексы?