[wd_asp elements=’search’ ratio=’100%’ id=1]

Php ‘week’ time format, convert to Start and End dates

5th October 2018

Php - Dates & Time

php codehaven

$week = "39";
$year = "2018";

function week_date($week, $year){
$date = new DateTime();
return $date->setISODate($year, $week, "1")->format('d/m/Y')
." - ".$date->setISODate($year, $week, "7")->format('d/m/Y');
}
echo week_date($week,$year);