Jump to content

PHP & MySQL Date formats....


smilinmonki666

Recommended Posts

Hi guys,

 

I would firstly like to apologise that its this subject again. From my research on the web the past 3 days I can see its a big problem & I think it could be my coding as I am learning. My code is as follow & what I am trying to do is return the date to dd/mm/yyyy & not yyyy/mm/dd.

 

Any help is welcome.

 

Thanks in advanced..

 

<?php
$con = mysql_connect("localhost", "admin", "password");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}

mysql_select_db("database",$con);

?>

					<? $result = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5");

					while($row = mysql_fetch_array($result))

				{
					echo "<div id=article>";
					echo "<a href=#>" . "<h1>" . $row{'title'} . " - " . "<small>" . $row{'date_add'} . "</a>" . "</small>";
					echo "<br>";
					echo "<p>" . $row{'intro'} . "<br>" . "<br>" . "<a href=#>" . "<small>" . "Comments" . "</small>" . "</a>" . "</p>";
					echo "</div>";	
				}

					?>

Link to comment
https://forums.phpfreaks.com/topic/189459-php-mysql-date-formats/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.