Non Well Formed Numeric Value Encountered in PHP Date

Non Well Formed Numeric Value Encountered in PHP Date

If you get "non well formed numeric value encountered" error in PHP while using date() function to save into MYSQL database, use strtotime() function to correct this:

$my_date = '20-12-2015';
echo date('Y-m-d', strtotime($my_date));

will output: 2015-12-20 which can be saved into MYSQL.

Share this Post