webguync Posted October 14, 2012 Share Posted October 14, 2012 I'm a little rusty at this. I have a field in MySQL set to type of timestamp and I am displaying it in an HTML table and it displays as 2012-10-14 13:09:07. I would rather have at display as Sunday, October 14th at 3:09. The code to pull the data is as follow: <?php mysql_connect("localhost","uname","pw");//database connection mysql_select_db("DBName"); $SQL = "SELECT * FROM organization ORDER BY time_created_t ASC"; $result = mysql_query($SQL); lt while($data = mysql_fetch_row($result)){ echo("<tr><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td><td>$data[5]</td><td>$data[6]</td><td>$data[7]</td><td>$data[8]</td><td>$data[9]</td><td>$data[10]</td><td>$data[11]</td><td>$data[12]</td></tr>"); } ?> the timestamp is in <td>$data[12]</td> Link to comment https://forums.phpfreaks.com/topic/269462-need-help-with-changing-date-display-from-mysql/ Share on other sites More sharing options...
Pikachu2000 Posted October 14, 2012 Share Posted October 14, 2012 It's faster to format the date in the query. http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format Link to comment https://forums.phpfreaks.com/topic/269462-need-help-with-changing-date-display-from-mysql/#findComment-1385201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.