Gem Posted March 14, 2009 Share Posted March 14, 2009 Hiya At least i think this is a quick question I need to echo 'date' ... but I dont want it in YYYY-MM-DD format, I want it to just be 14th March for example... Is there an easy way to do that? Cheerz Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/ Share on other sites More sharing options...
redarrow Posted March 14, 2009 Share Posted March 14, 2009 flash way. <?php echo wordwrap(date("d F"), 3, "th ");?> Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/#findComment-784721 Share on other sites More sharing options...
Gem Posted March 14, 2009 Author Share Posted March 14, 2009 hmmmmm ... excuse my ignorance... <?php mysql_select_db("bssql", $con); $result = mysql_query("SELECT `event`, `date` FROM `diary` ORDER BY date DESC LIMIT 5") or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { ?><b><a href="diary.php"><?php echo $row['event'];?></a></b> <BR><?php echo $row['date']?><BR><BR><?php } mysql_close($con); ?> Where would I put that??? ... ??? Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/#findComment-784728 Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 i would try something like this... <?php mysql_select_db("bssql", $con); $result = mysql_query("SELECT `event`, `date` FROM `diary` ORDER BY date DESC LIMIT 5") or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $date = explode("-",$row['date']); $date = date("jS F Y",mktime(0,0,0,$date[1],$date[2],$date[0])); echo '<b><a href="diary.php">'.$row['event'].'</a></b> <br />'.$date.'<br /><br />'; } mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/#findComment-784734 Share on other sites More sharing options...
Gem Posted March 14, 2009 Author Share Posted March 14, 2009 Thank you ... I gotta run down the shop so I'll test it when I get back and let you know Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/#findComment-784751 Share on other sites More sharing options...
Gem Posted March 14, 2009 Author Share Posted March 14, 2009 yup - that did it ... thanks very much. I've kept the code in my "I should probably learn waht this actually means" file as well so I dont have to ask the same question next time!! Thanks again x Link to comment https://forums.phpfreaks.com/topic/149413-solved-quick-echo-date-question/#findComment-784803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.