Tools\Utility\Time::cWeek PHP Method

cWeek() public static method

TODO: use timestamp - or make the function able to use timestamps at least (besides dateString) date('W', $time) returns ISO6801 week number. Exception: Dates of the calender week of the previous year return 0. In this case the cweek of the last week of the previous year should be used.
public static cWeek ( mixed | null $dateString = null, integer $relative ) : string
$dateString mixed | null In DB format - if none is passed, current day is used
$relative integer - weeks relative to the date (+1 next, -1 previous etc)
return string
    public static function cWeek($dateString = null, $relative = 0)
    {
        //$time = self::fromString($dateString);
        if ($dateString) {
            $date = explode(' ', $dateString);
            list($y, $m, $d) = explode('-', $date[0]);
            $t = mktime(0, 0, 0, $m, $d, $y);
        } else {
            $d = date('d');
            $m = date('m');
            $y = date('Y');
            $t = time();
        }
        $relative = (int) $relative;
        if ($relative != 0) {
            $t += WEEK * $relative;
            // 1day * 7 * relativeWeeks
        }
        if (($kw = date('W', $t)) === 0) {
            $kw = 1 + date($t - DAY * date('w', $t), 'W');
            $y--;
        }
        return $kw . '/' . $y;
    }