Friday, February 15, 2013

Function to get the last day (saturday) of current week


/**
 * Function to get the last day (saturday) of current week
 *
 * @return string
 */
function get_week_end_date()
{
$format = 'M d, Y';

// if today is saturday, return today's date
if (date('N') === 7)
{
return date($format);
}
else
{
// return next saturday's date
return date($format, strtotime('next saturday'));
}
}