Jump to content

A non well formed numeric value encountered


bravo14

Recommended Posts

I am trying to echo a date using the following code

 

 

<?php echo date(strtotime("d M Y",$order_row['od_date']));?>

 

but I am getting the following error message

 

Notice: A non well formed numeric value encountered in /Applications/MAMP/htdocs/Nick Morris/admin/invoice.php on line 86

 

The data type for the field from the database is DateTime, any ideas what is going wrong

You need to look at those two functions and what they expect - you have the parameters messed up.

 

date() takes a string as the first parameter to determine the format and an optional second parameter for a timestamp

 

strtotime() takes a string representing a data and an optional second parameter of a timestamp.

 

Your code has both of the parameters for those two function put into the strtotime() function. So,it is giving you that error because the second parameter you passed to strtotime() is not a timestamp.

 

Try

 

<?php echo date("d M Y", strtotime($order_row['od_date']));?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.