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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.