Я пытаюсь написать функцию календаря, подобную этой
function get_date($month, $year, $week, $day, $direction)
{
....
}
$week
- целое число (1, 2, 3...), $day - день (Солнце, Пн,...) или номер, в зависимости от того, что проще. Направление немного запутанно, потому что оно делает другой расчет.
Например, позвоните
get_date(5, 2009, 1, 'Sun', 'forward');
Он использует значение по умолчанию и получает первое воскресенье мая, т.е. 2009-05-03. Если мы будем называть
get_date(5, 2009, 2, 'Sun', 'backward');
он возвращает второе последнее воскресенье мая, т.е. 2009-05-24.