megha_3000
10-01-2012, 11:36 AM
i used the function on my php script
function dateconvert($date,$func){
if ($func == 1){ //insert conversion
list($day, $month, $year) = explode('[/.-]', $date);
$year=trim($year);
$date = "$year-$month-$day";
return $date;
}
if ($func == 2){ //output conversion
list($year, $month, $day) = explode('[-.]', $date);
if(trim($date)!=='') $date = "$day/$month/$year";
return $date;
}
}
but at the time of execution it shows an error
: Incorrect date value: '--17-10-1989' for column 'dob' at row 1
the data type of dob is date default null.
how can i recover the error. help me. please give any suggestion.
function dateconvert($date,$func){
if ($func == 1){ //insert conversion
list($day, $month, $year) = explode('[/.-]', $date);
$year=trim($year);
$date = "$year-$month-$day";
return $date;
}
if ($func == 2){ //output conversion
list($year, $month, $day) = explode('[-.]', $date);
if(trim($date)!=='') $date = "$day/$month/$year";
return $date;
}
}
but at the time of execution it shows an error
: Incorrect date value: '--17-10-1989' for column 'dob' at row 1
the data type of dob is date default null.
how can i recover the error. help me. please give any suggestion.