| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
dev 18.11.2005 19:51
Мелочь, но может кому-то и пригодится...# Parameters: year is natural number, month is int 1..12.
# Result is number of days at a month (int).
@days_per_month[month;year][_days_per_month]
^if($month == 2 && ^is_leap_year[$year]){
$result(29)
}{
$_days_per_month[
$.1(31)
$.2(28)
$.3(31)
$.4(30)
$.5(31)
$.6(30)
$.7(31)
$.8(31)
$.9(30)
$.10(31)
$.11(30)
$.12(31)
]
$result($_days_per_month.$month)
}
# Parameter (year) is natural number, result is bool.
# Returns true if year is leap, else false.
@is_leap_year[year]
$result(($year&3) == 0 && $year%100 != 0 || $year%400 == 0)Keywords: високосный год, дней в месяце, дней в феврале.