View Full Version : how to customise how the date is shown?

05-26-2011, 09:52 PM
Hi, how do i change how the date is displayed?

currently a when i post news on my cms along with the article it auto posts a date and time of post.

Now when i output the date its shown as:
2011-05-26 09:51:44

is it possible to edit how the date is shown?

This is how i grap the data:

while ($row = mysql_fetch_assoc($getnews))
$date = $row['date'];

and output:

<?php echo $date ?>

05-26-2011, 10:08 PM
Check strftime (http://gr.php.net/strftime) and strtotime (http://gr.php.net/manual/en/function.strtotime.php)
e.g. echo date("d/m/Y H:i:s", strtotime($date));

05-26-2011, 10:08 PM
Have a look at:

$date = '2011-05-26 09:51:44';

echo date( 'F jS, Y', strtotime( $date ) ); // May 26th, 2011

05-26-2011, 10:26 PM
thanks guys, big help there, i saw that php page, had issues in getting the actual date from the DB, instead was posting the date now instead lol, sorted now :D cheers again