...

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



TurkzZ
05-26-2011, 08: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:

<?php
while ($row = mysql_fetch_assoc($getnews))
{
$date = $row['date'];
?>

and output:


<?php echo $date ?>

gvre
05-26-2011, 09: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));

kbluhm
05-26-2011, 09:08 PM
Have a look at:
http://www.php.net/date
http://www.php.net/strtotime



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

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

TurkzZ
05-26-2011, 09: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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum