- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
function DI_MNum($Mon, $Year) {
$nn = Array(31,28,31,30,31,30,31,31,30,31,30,31);
$x = 28;
$y = (Round($Year/4))*4;
if ($y==$Year) $x = 29;
$ret = $nn[$Mon];
if ($Mon==1) $ret = $x;
return $ret;
}
function DI_FirstDay($Mon,$Year) {
$x0 = 365;
$Y = $Year-1;
$days = $Y*$x0+floor($Y/4)+6;
for ($j=0; $j<$Mon; $j=$j+1) {
$days = $days+DI_MNum($j,$Year);
}
$week = $days-(7*Round(($days/7)-0.5));
return $week;
}
function even_week($Day,$Mon,$Year) {
$x0 = 365;
$Y = $Year-1;
$days = $Y*$x0+floor($Y/4)+6;
for ($j=0; $j<$Mon; $j=$j+1) {
$days = $days+DI_MNum($j,$Year);
}
$days = $days + $Day;
$weeks = ceil($days/7);
$res = false;
if (2*ceil($weeks/2) == $weeks) $res = true;
return $res;
}
Комментарии (0) RSS
Добавить комментарий