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... Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/ 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. Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955423 Share on other sites More sharing options...
nojhere Posted November 11, 2009 Author Share Posted November 11, 2009 Thanx....solved.... GOD BLESS YOU!!.. Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955434 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??? Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955438 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? Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955440 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.. Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955441 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"; Link to comment https://forums.phpfreaks.com/topic/181072-somebody-out-therei-need-help/#findComment-955464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.