Jump to content

Displaying Dates


bravo14

Recommended Posts

Hi All

 

I have some dates in a mysql database and it is the format of yyyy-mm-dd and I wanto to display it in a differnet format on the web pages.

 

Any assistance would be much appreciated.

 

Mark

Link to post
Share on other sites

heres a function i created

 

<?php
function mydate($record){
$date =  strtotime($record);
echo date('d/m/y',$date);
}
?>

 

change the date('d/m/y') to suit the way you want it

Link to post
Share on other sites

Thanks for your help guys.

 

Craygo just out of curiosity as I am relatively new to PHP/MySQL where in the code below would I put the code you suggested?

$result = mysql_query('SELECT * FROM `reports` ORDER by report_id LIMIT 0, 30 ', $con);
while($row = mysql_fetch_array($result))

{
echo ('<tr class="profiletext"><td>'.$row[date].'</td>');

Link to post
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.