As NullUserException mentioned, you can use strtotime
to convert the date strings to timestamps. You can output 'intelligent' ranges by using a different date format for the first date, determined by comparing the years, months and days:
$date1 = "2011/07/01";
$date2 = "2011/07/11";
$t1 = strtotime($date1);
$t2 = strtotime($date2);
// get date and time information from timestamps
$d1 = getdate($t1);
$d2 = getdate($t2);
// three possible formats for the first date
$long = "j F Y";
$medium = "j F";
$short = "j";
// decide which format to use
if ($d1["year"] != $d2["year"]) {
$first_format = $long;
} elseif ($d1["mon"] != $d2["mon"]) {
$first_format = $medium;
} else {
$first_format = $short;
}
printf("%s - %s\n", date($first_format, $t1), date($long, $t2));