Dapatkan Tanggal ke Tanggal Hari Terakhir atau Hari Pertama


function getWeekDates($date)
{
    $week =  date('W', strtotime($date));
    $year =  date('Y', strtotime($date));
    $from = date("Y-m-d", strtotime("{$year}-W{$week}-1")); //Returns the date of monday in week
    $to = date("Y-m-d", strtotime("{$year}-W{$week}-7"));   //Returns the date of sunday in week
    
    $returnArray = array();
    $returnArray['start_date'] = $from;
    $returnArray['end_date'] = $to;
    return $returnArray;
    //echo "Start Date-->".$from."End Date -->".$to;//Output : Start Date-->2012-09-03 End Date-->2012-09-09
}
Rht