RON_ron Posted August 26, 2010 Share Posted August 26, 2010 I need to change the date format to DD-MM-YYYY. Please help. $SomeVar = $_POST['finco']; $query = "SELECT * FROM news_home WHERE code = '".$SomeVar."' ORDER BY timestamp DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subject"].",,".$line["timestamp"].",,".$line["News"].",,".$line["links"].",,,"; } echo $returnS; mysql_close($link); ?> Quote Link to comment Share on other sites More sharing options...
freelance84 Posted August 26, 2010 Share Posted August 26, 2010 http://php.net/manual/en/function.date.php Quote Link to comment Share on other sites More sharing options...
RON_ron Posted August 26, 2010 Author Share Posted August 26, 2010 I believe this is the way to achieve it but it doesn't seem to work! Any idea why is that? $SomeVar = $_POST['finco']; $query = "SELECT DATE_FORMAT(timestamp, '%d/%m/%Y') FROM news_home WHERE code = '".$SomeVar."' ORDER BY timestamp DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subject"].",,".$line["timestamp"].",,".$line["News"].",,".$line["links"].",,,"; } echo $returnS; mysql_close($link); ?> Quote Link to comment Share on other sites More sharing options...
Jurge Posted August 26, 2010 Share Posted August 26, 2010 $date = date('D d Y h:i'); Quote Link to comment Share on other sites More sharing options...
RON_ron Posted August 27, 2010 Author Share Posted August 27, 2010 Worked! Thanks mate!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.