- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$id = 1;
$day = '2012-10-04';
$mydate = date("Y-m-d",strtotime($day." last Sunday "));
$item_key = $mydate.'_'.$id;
$data[$item_key] = array( 'date' => $mydate, 'offer_id' => $id );
?>