Days of current month

Hi folks,

How would I echo out a table showing the days of the 'current month/year?

1-may-10 - data here
2-may-10 - data here

prev month - next month

As its the current year, you need only need to capture whether its next or previous, unless of course you are going to make a cal in which the user can endlessly go backwards or forwards …

Will you let them do that?

Awesome! Thanks guys!
How would I go about determining and echoing out:

Prev month - next month


$date = '2010-06-01';
$strtotime = strtotime($date);
while(true){
    echo date("d-M-y", $strtotime) . ' ---> Data<br />';
    if(date('t', $date) == date('d', $strtotime))
        break;
    $strtotime = strtotime("1 day", $strtotime);
}


$date = $_GET['date'];
if(empty($date) || date('Y', strtotime($date)) == 1970){
    $date = date('Y-m-1');
}

$prev = date('Y-m-1', strtotime("previous month", strtotime($date)));
$next = date('Y-m-1', strtotime("next month", strtotime($date)));
echo '<a href="index.php?date=' . $prev . '">Previous Month</a>';
echo ' | <a href="index.php?date=' . $next . '">Next Month</a><br />';

$strtotime = strtotime($date);
while(true){
    echo date("d-M-y", $strtotime) . ' ---> Data<br />';
    
    if((int)date('t', strtotime($date)) == (int)date('d', $strtotime))
        break;
    $strtotime = strtotime("1 day", $strtotime);
}

Need to sanitize the date input from GET. Hope you can manage it yourself.

You can use the cal_days_in_month() function:

for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN, $month, $year); ++$i)
{
   echo $i;
}

echo date('M', strtotime('last month'));

May

or do you mean you want to echo a link which evokes an sql query?

Eventually yes, that was the plan