What is desired is the following, a function that receives as a parameter, the week number of a specific year and returns the date on which it starts and ends that week. for example
function weekStartEnd($weekNumber,$year){
$firstDateOfWeek=date('w',strtotime('???'));
$lastDateOfWeek=date('w',strtotime('???'));
return [$firstDateOfWeek,$lastDateOfWeek];
}
The problem is that I do not know how to use strtotime
, or mktime
to get the fecha de inicio y fin de esa semana
.
In summary, a function that can answer the question, when does it start and end week 1 of the year 2018? And that returns as a result
from 01/01/2018 to 06/01/2018
If the solution can be javaScript
is also accepted