mysql - Use of date function in PHP to output a user-friendly date -


i have mysql database column named dateadded.
i'd echo readable date/time.
here simplified version of code have:

$result = mysql_query("     select listitem, dateadded     lists     userid = '" . $currentid . "'      "); while($row = mysql_fetch_array($result))     {     // make date nicer     $dateadded = date('d-m-y',$row['dateadded']);      echo $row['listitem'] . ",";     echo $dateadded;     echo "<br />";     } 

is use of date function best way output user-friendly date?

thanks taking look,

if don't plan on outputting dates beyond 2038, fine using date().

otherwise, use php's datetime doesn't have limitation, or mysql's date formatting functions format date directly in database.

however, seem storing timestamp in database. have considered switching datetime field?


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -