I have an array $creation_date[] that I am looping throu开发者_JAVA技巧gh. This contains MySQL timestamps. I want to change these timestamps into dates like January 4, 1992. I have this code: date('F j, Y', $creation_date[$i]) (its in a while loop with $i incrementing it). It is returning an error at that line A non well formed numeric value encountered. Any idea what is wrong?
You first have to use the strtotime() function.
date() assumes a unix timestamp (like time()) as a second argument, and the string coming from mysql is a string :)
Try date('F j, Y', strtotime($creation_date[$i]));
not sure on that error but i think you need strtotime in there: date('F j, Y', strtotime($creation_date[$i]))
if that doesn't work, as you looping if you print the $creation_date[$i] does it print as expected?
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论