/// Новый год
$currentYear = date('Y'); $newYear = mktime(0, 0, 0, 1, 1, $currentYear + 1); $seconds = $newYear - time(); $days = 0; $hours = 0; $minutes = 0;
$oneMinute = 60;
$oneHour = 60 * $oneMinute;
$oneDay = $oneHour * 24;
if ($seconds / $oneDay > 0) {
$days = (int)($seconds / $oneDay);
$seconds -= $days * $oneDay;
}
if ($seconds / $oneHour > 0) {
$hours = (int)($seconds / $oneHour);
$seconds -= $hours * $oneHour;
}
if ($seconds / $oneMinute > 0) {
$minutes = (int)($seconds / $oneMinute);
$seconds -= $minutes * $oneMinute;
}
if($days >= 5)$dname = "<b>$days</b> дней";
elseif($days == 1)$dname = "<b>$days</b> день";
else $dname = "<b>$days</b> дня";
}else{
if($d >= 5 || $d == 0)$dname = "<b>$days</b> дней";
elseif($d == 1)$dname = "<b>$days</b> день";
else $dname = "<b>$days</b> дня";
}
if($hours >= 5)$dhour = "<b>$hours</b> часов";
elseif($hours == 1)$dhour = "<b>$hours</b> час";
else $dhour = "<b>$hours</b> часа";
}else{
if($h >= 5 || $h == 0)$dhour = "<b>$hours</b> часов";
elseif($h == 1)$dhour = "<b>$hours</b> час";
else $dhour = "<b>$hours</b> часа";
}
if($minutes >= 5)$dmin = "<b>$minutes</b> минут";
elseif($minutes == 1)$dmin = "<b>$minutes</b> минута";
else $dmin = "<b>$minutes</b> минуты";
}else{
if($m >= 5 || $m == 0)$dmin = "<b>$minutes</b> минут";
elseif($m == 1)$dmin = "<b>$minutes</b> минута";
else $dmin = "<b>$minutes</b> минуты";
}
if($seconds >= 5)$dsec = "<b>$seconds</b> секунд";
elseif($seconds == 1)$dsec = "<b>$seconds</b> секунда";
else $seconds = "<b>$dsec</b> секунды";
}else{
if($s >= 5 || $s == 0)$dsec = "<b>$seconds</b> секунд";
elseif($s == 1)$dsec = "<b>$seconds</b> секунда";
else $dsec = "<b>$seconds</b> секунды";
}
if($days > 0){
echo "<div class='text'><center>До <span style='color: red'>Нового Года</span> осталось:<br/>$dname $dhour $dmin $dsec</center></div>";
}else{
echo "<div class='text'><center><span style='color: red'>С новым годом!!!!</span></center></div>";
}
////