The week() function of MySql gives number of week from 0-53.
I have a weeknumber and I want to have the "start date" and "end date" of the week represented by weeknumber. How can I do that?
If there is no way of getting "start date" and "end date" of a week directly, how can I the "start week day" and "end week day" from the week number? I tried to get the first day (Monday) of the week by using the following query:-
$currentWeek = 7;
for($w = 0; $w <= $currentWeek; $w++)
{
$actualWeek = intval($w + 1);
if($w < 10)
$queryWeek = '0'.$actualWeek;
else
$queryWeek = $actualWeek;
$thisYearWeek = date('Y').$queryWeek;
$weekMondayQuery = $this->CustomerPayment->query("SELECT STR_TO_DATE('$thisYearWeek', '%X%V %W')");
}
The Jan 1, 2018 was Monday. For the First week, ie. when $thisYearWeek = '201801'
, I am getting Monday date as 2018-01-08 instead of 2018-01-01.