如何使用日期回应默认的date 0000-00-00(“F j,Y,”); 如果日期没有更新?

in my database default value of date is set to not null 0000-00-00and i use the date format date("F j, Y, "); to print out the date.

if i echo the date using strtotime function in the following way,

echo date("F j, Y", strtotime($row_schedule['meeting_date']));

it returns November 30, -0001 based on the set default date 0000-00-00

whereas if i update the default value of date from 0000-00-00 to a real time date like, 2013-02-28 it gives the appropriate output as it should be like,

February 28, 2013

my question is how can i print default date as 0000-00-00 but not November 30, -0001 using my current output method?

You can always write your own function

function myDate($time){
  if($time == '0000-00-00')
     return $time;
  return date("F j, Y", strtotime($time));
}

and then just echo myDate($row_schedule['meeting_date']);.

strtotime returns false for invalid dates - this is where your integrity check should be.

$time = strtotime($var_from_db);
if($time!==false)
  echo date("F j, Y", $time);

Add a condition,

echo $row_schedule['meeting_date'] == '0000-00-00'?
'your default time/string':
date("F j, Y", strtotime($row_schedule['meeting_date']));

the other simple method is

if ($row_schedule['meeting_date'] == '0000-00-00') {
echo '0000-00-00';
}else{
echo
date("F j, Y g:i A", strtotime($row_schedule['meeting_date']));
}

thanks,