1. PHP / Говнокод #14054

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    /*
         * Calculates date for $count_days before today
         * 
         * @param int $count_days - how much days before today
         * @return date - date for $count_days before today
         */
        function DaysBeforeToday($count_days) {
            $date = date('Y-m-d');
            $pos = strrpos($date, '-');
            $date = substr($date, 0, $pos + 1) . (substr($date, $pos + 1, 2) - $count_days);
            return $date;
        }

    ня! ^^

    Запостил: ragnar, 22 Октября 2013

    Комментарии (8) RSS

    Добавить комментарий