hi,
i have news with a date field (0000-00-00) stored in my db.
for a blog-like archive sidebar i want to list all the months where a news article is available, like
March 2006
January 2006
December 2005
….
to convert the date data i use
[code=php]
$date = mysql_result($result, “date”);
function dateconvert($date,$func) {
//….
if ($func == 3){ //output conversion
list($year, $month, $day) = split(‘[-.]’, $date);
$date = “$month $year”;
return $date;
}
$period = dateconvert($date,3);
echo $period;
// this results in an output like
// 03 2006
since i want 03 displayed as March i modified the conversion function like this:
[code=php]
if ($func == 3){ //output conversion
list($year, $month, $day) = split(‘[-.]’, $date);
$month = date(“F”, $month);
$date = “$month $year”;
return $date;
}
but now i always get “January”, no matter what the month is. the year is still displayed correctly.
any ideas?