nojhere Posted November 11, 2009 Share Posted November 11, 2009 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... Quote Link to comment Share on other sites More sharing options...
exally Posted November 11, 2009 Share Posted November 11, 2009 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. Quote Link to comment Share on other sites More sharing options...
nojhere Posted November 11, 2009 Author Share Posted November 11, 2009 Thanx....solved.... GOD BLESS YOU!!.. Quote Link to comment Share on other sites More sharing options...
nojhere Posted November 11, 2009 Author Share Posted November 11, 2009 Opss....wait.. Just to ask a little bit more.. How to change November to Nov??? Quote Link to comment Share on other sites More sharing options...
gizmola Posted November 11, 2009 Share Posted November 11, 2009 What is the mysql data type of the column named date? Quote Link to comment Share on other sites More sharing options...
nojhere Posted November 11, 2009 Author Share Posted November 11, 2009 Done...im doing by myself...Thanx a lot all.. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 11, 2009 Share Posted November 11, 2009 Simple, just do it in the query when you select the column - $q = "SELECT DATE_FORMAT(date,'%e %b %Y') as date FROM template"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.