In PHP, how could I calculate the date of all days in a week using day of the week number and the current date?
My code:
$daynumber=date("N",time());
$date = date("l j F Y", strtotime("+ ".$daynumber." days"));
EDIT:
I have a scheduler script and I'm trying to get the date of every day of the week like this in a table:
Monday Tuesday Wednesday Thursday Friday
24-11 25-11 26-11 27-11 28-11
I think I don't understand your question properly, but you can get the start and end date for a week with the current week and year for example..
function getStartAndEndDate($week, $year) {
$dto = new DateTime();
$ret['week_start'] = $dto->setISODate($year, $week)->format('Y-m-d');
$ret['week_end'] = $dto->modify('+6 days')->format('Y-m-d');
return $ret;
}