How to find the start and end date of the week for a given year and week number? it is used for to insert the weeks dates for each employee in Work shift in the Hr module project,so kindly help me
Thanks in advance, shiva
How to find the start and end date of the week for a given year and week number? it is used for to insert the weeks dates for each employee in Work shift in the Hr module project,so kindly help me
Thanks in advance, shiva
function Start_End_Date_of_a_week($week, $year){
$time = strtotime("1 January $year", time());
$day = date('w', $time);
$time += ((7*$week)+1-$day)*24*3600;
$dates[0] = date('Y-n-j', $time);
$time += 6*24*3600;
$dates[1] = date('Y-n-j', $time);
return $dates;
}
$result = Start_End_Date_of_a_week(35,1998);
echo 'Starting date of the week: '. $result[0]."\n";
echo 'End date the week: '. $result[1];