to start with you would want to look at either substr(); or explode();
substr(); could be used because all the entries are the same length and would be easy to see if the date 2004-01-28 wasin your database
using something like this
<?
$string = "2004-01-28";
$year = substr($string, 0, 4); // will return 2004
$month = substr($string, 5, 2); // will return 01
$day = substr($string, 8, 2); // will return 28
?>
this can then be used in conjunction with your days
explode(); could be used, using the character "-", which seperates the dates, to split the string
eg.
<?
$string = "2004-01-28";
list($year, $month, $day) = explode("-", $string);
echo $year; // returns 2004
echo $month; // returns 01
echo $day; // returns 28
?>
i'm not sure exactly how this could be used to do what you want it to do but i'm sure, or i hope this will help you get there