johanafm;10997732 wrote:Use [man]date[/man] and [man]mktime[/man]. Check what weekday it is, then add/sub the proper amount of days to get to the correct date for week start and week end.
I'm not certain, but it's possible that strtotime would work if you find out the week number and use something like "first day of week NN year MMMM.
thanks for reply, i got the solution
function x_week_range($date) {
$ts = strtotime($date);
$start = (date('w', $ts) == 0) ? $ts : strtotime('last sunday', $ts);
return array(date('Y-m-d', $start),
date('Y-m-d', strtotime('next saturday', $start)));
}