You are were using mktime() wrong. It's:
int mktime ([ int $hour = date("H") [, int $minute = date("i") [, int $second = date("s") [, int $month = date("n") [, int $day = date("j") [, int $year = date("Y") [, int $is_dst = -1 ]]]]]]] )
... and you have:
mktime(0, 0, 0, $day_end, $month_end, $year_end)
Fixed that, you're probably hitting the issue that the note in the strftime()
manual page warns about:
Note: %G and %V, which are based on ISO 8601:1988 week numbers can give unexpected (albeit correct) results if the numbering system is not thoroughly understood. See %V examples in this manual page.
31st Dec 2013 belongs to first ISO week of next year.
You probably want %Y
instead.