bravo14 Posted June 28, 2013 Share Posted June 28, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/279671-a-non-well-formed-numeric-value-encountered/ Share on other sites More sharing options...
Solution Psycho Posted June 28, 2013 Solution Share Posted June 28, 2013 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']));?> Quote Link to comment https://forums.phpfreaks.com/topic/279671-a-non-well-formed-numeric-value-encountered/#findComment-1438422 Share on other sites More sharing options...
bravo14 Posted June 28, 2013 Author Share Posted June 28, 2013 Thanks, yeah remember now, just looked at it for so long couldn't spot it Quote Link to comment https://forums.phpfreaks.com/topic/279671-a-non-well-formed-numeric-value-encountered/#findComment-1438426 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.