Howdy all,
I am pulling dates from mysql in yyyy-mm-dd format. I would like to display them in another format, either mm.dd.yyyy or month name, dd, yyyy.
I found the below script and it would work, but I have 5 "updates" being displayed on one page and I don't want to interfere with the display of the content. View http://www.plusoneonline.com/home to see what I am talking about.
What would be the best way of doing this? I am using this code to pull from the DB.Code:$date = "2000-12-11"; $temp = explode("-", $date); $year = $temp[0]; $month = $temp[1]; $day = $temp[2]; print date ("l, F jS, Y", mktime (0,0,0,$month,$day,$year));
The part in bold is a way for me to show a "NEW" image for entries that are newer than 3 days (I am still working on that part)Code:<?php $conn = mysql_connect($dbhost, $dbuser, $dbpass); if (!$conn) { echo "<P>Unable to connect to the database server at this time.</P>"; exit(); } if (! @mysql_select_db($dbname) ) { echo( "<P>Unable to locate the database at this time.</P>" ); exit(); } $result = mysql_query("SELECT date, content FROM po_updates ORDER BY date DESC LIMIT 5;"); if (!$result) { echo "<P>Error performing query on database"; exit(); } while ($row = mysql_fetch_array($result)) { echo "<span class=\"divider\" width=\"100%\">"; if ($row["date"] > 3) { echo "<img src=\"../images/image_new.gif\" width=\"30\" height=\"15\" border=\"0\" align=\"left\">"; } echo " ".$row["date"]."</span><br><br>"; echo $row["content"]; echo "<br><br>"; } ?>






Bookmarks