Forum Moderators: coopster
the sql to convert the timestamp to dd/mm/yy is:
select DATE_FORMAT(posted, '%D %M, %Y') from news;
but trying to display the page is a nightmare. errors such as:
DW MX 2004 produces this code @ the top of the page for the query:
mysql_select_db($database_mewannews, $mewannews);
$query_getdate = "SELECT DATE_FORMAT(posted, '%e %M, %Y ') FROM news";
$getdate = mysql_query($query_getdate, $mewannews) or die(mysql_error());
$row_getdate = mysql_fetch_assoc($getdate);
$totalRows_getdate = mysql_num_rows($getdate);
and this code to display the date
<?php echo $row_getdate['posted'];?>
print '<pre>';
print_r($row_getdate);
exit '<pre>'; // I often use exit to halt processing; you can also use print to continue...
That said, I think you'll find that your error is resolved by simply assigning your variable name to your DATE_FORMAT expression as an alias:
$query_getdate = "SELECT DATE_FORMAT(posted, '%e %M, %Y ') AS posted FROM news";