troubleshooting Question

Notice: A non well formed numeric value encountered in

Avatar of zolf
zolfFlag for United Arab Emirates asked on
PHP
2 Comments2 Solutions4871 ViewsLast Modified:
Hello there,

I have this function which gets the date and time from the database table.this is the format in the table
 2006-02-13 10:22:34. now i want to print the date, i get this error Notice: A non well formed numeric value encountered.......when i did a print_r(). i got this Array ( [0] => 2006 [1] => 02 [2] => 13 10:22:34 ).so i guess [2] which contains the day and time is causing this error.how can i solve this problem.please help.

cheers
zolf

function formatDate($val)
{
      $arr = explode("-", $val);
      print_r($arr);
      return date("d. F Y.", mktime (0,0,0, $arr[1], $arr[2], $arr[0]));
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros