Jump to content

Somebody out there...i need help...


nojhere

Recommended Posts

This is my code..

 

$q = "SELECT date FROM template";

$qexec = mysql_query($q) or die(mysql_error());

 

$i = 1;

while($col = mysql_fetch_assoc($qexec))

{

 

 

if($col['date'] != '')

{

 

                      $XX=$col['date'];}

 

        }

       

        echo $XX;

 

 

The output will be 2009-11-10...

 

How to change that date to 10 Nov 2009????

 

Simple but i don't know how...

 

 

Link to comment
https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/
Share on other sites

simplest way for you would be to run in through a function that converts from that format to the desired

 


$time = str_replace(array(" ", ":"), array("-","-"), $col['date']); //format for explode
$time = explode("-", $time);

$time_stamp = mktime($time[3], $time[4], $time[5], $time[1], $time[2], $time[0]); //Convert to timestamp

print date('d F Y', $time_stamp);

 

There is probably a better way, but none that involves that sort of simplicity.

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.