kernel/lib/Date.php
public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array
    {
        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));

        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
        else { $iShift = (8 - $iFirstDayInYear) * 86400; }

        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
        else { $iWeekInSeconds = 0; }

        if (date('N') > 2) {

            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800;
            $iTimestampLastDay = $iTimestamp + 604800;
        }
        else {

            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000;
            $iTimestampLastDay = $iTimestamp + 604800;
        }

        $aDates = array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));

        if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) {

            $aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]);
            $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]);
        }

        return $aDates;
    }
public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array
    {
        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));

        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
        else { $iShift = (8 - $iFirstDayInYear) * 86400; }

        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
        else { $iWeekInSeconds = 0; }

        if (date('N') > 2) {

            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800;
            $iTimestampLastDay = $iTimestamp + 604800;
        }
        else {

            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000;
            $iTimestampLastDay = $iTimestamp + 604800;
        }

        $aDates = array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));

        if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) {

            $aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]);
            $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]);
        }

        return $aDates;
    }
set name of image

@access public
@param  int $iWeek number of week
@param  int $iYear year
@param string $sFormat
@return array|Date