richrock Posted October 30, 2008 Share Posted October 30, 2008 , Having a little difficulty in displaying modified dates on a page - they're all stuck at 1970 and all the tutorials I find just talk about using date() without the results of a mysql query. Hi $getBids = "SELECT * FROM jos_bids ORDER BY id_offer ASC"; $resBids = mysql_query($getBids) or die(mysql_error()); // generate the rows while ($row_bids = mysql_fetch_array($resBids)) { $id_offer = $row_bids['id_offer']; $userid = $row_bids['userid']; $bid_price = $row_bids['bid_price']; $date_placed = date("d.m.Y",$row_bids['modified']); $time_placed = date("H.i.s",$row_bids['modified']); As you can see, I've placed the date in the while function. However, when I echo $date_placed and $time_placed, I get 01.01.1970, and 01.33.28 respectively. How do I get the actual real dates displayed? Link to comment https://forums.phpfreaks.com/topic/130720-solved-probably-dead-easy-but-displaying-date-from-mysql-in-while/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 30, 2008 Share Posted October 30, 2008 $row_bids['modified'] would need to be a Unix timestamp for that code to work. If $row_bids['modified'] is a mysql DATETIME, just use the mysql DATE_FORMAT() function in your query to give you the output in any format you want. Link to comment https://forums.phpfreaks.com/topic/130720-solved-probably-dead-easy-but-displaying-date-from-mysql-in-while/#findComment-678373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.