Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $date = '28-02-2015'
- $nextDateWeek = new \DateTime(date('Y-m-d', strtotime($date . '+1 week')));
- $lastDateWeek = new \DateTime(date('Y-m-d', strtotime($date . '-1 week')));
- $lastWeek = $nextDateWeek->format("W");
- $nextWeek = $lastDateWeek->format("W");
- $selectedYear = date('Y', strtotime($date));
- $nextWeekDays = Common::getStartAndEndDate($nextWeek, $selectedYear);
- $lastWeekDays = Common::getStartAndEndDate($lastWeek, $selectedYear);
- public static function getStartAndEndDate($week, $year)
- {
- $dto = new \DateTime();
- $dto->setISODate($year, $week);
- $ret['firstDay'] = $dto->format('d-m-Y');
- $dto->modify('+6 days');
- $ret['lastDay'] = $dto->format('d-m-Y');
- return $ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement