dachshund Posted May 14, 2008 Share Posted May 14, 2008 Hi, does anyone know how to print the DATE from a mysql database in a more user friendly format. ie. 15th June 08 rather than 2008-06-15 Thanks Link to comment https://forums.phpfreaks.com/topic/105672-solved-print-date-in-a-more-user-friendly-format/ Share on other sites More sharing options...
Barand Posted May 14, 2008 Share Posted May 14, 2008 www.php.net/date echo date('jS F y', strtotime($dbdate)); Link to comment https://forums.phpfreaks.com/topic/105672-solved-print-date-in-a-more-user-friendly-format/#findComment-541409 Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 probably being stupid but i still can't get it to work. Here's the code <table width="500" border="0" align="left" cellpadding="5"> <?php $id=$_GET['id']; $sql="SELECT * FROM events WHERE id='$id'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <tr> <td width="50%" align="left" valign="top" class="smallertitle"> <? echo $rows['title']; ?> </td> <td width="50%" align="right" valign="top" class="condensedeventcontent"> <? echo $rows['type']; ?> </td> </tr> <tr> <td width="100%" align="left" valign="top" colspan="2"> <img src="<? echo $rows['largeimage']; ?>" /> </td> </tr> <tr> <td width="100%" align="justify" valign="top" colspan="2" class="imagespecs"> <? echo $rows['imagespecs']; ?> </td> </tr> <tr> <td width="100%" align="justify" valign="top" colspan="2" class="maincontent"> <? echo $rows['description']; ?> </td> </tr> <tr> <td width="100%" align="left" valign="top" class="eventaddressdate"> <span class="condensedeventtitle"><? echo $rows['venue']; ?></span> <br /> <? echo $rows['street']; ?> <br /> <? echo $rows['city']; ?> <br /> <? echo $rows['postcode']; ?> </td> </tr> <tr> <td width="100%" align="left" valign="bottom" class="eventaddressdate"> Starts: <span class="condensedeventtitle"><? echo $rows['startdate']; ?></span> <br /> Ends: <span class="condensedeventtitle"><? echo $rows['enddate']; ?></span> </td> </tr> <tr> <td width="100%" colspan="2" align="left" valign="bottom" class="wordsby"> <a href ="<? echo $rows['webaddress']; ?>"><? echo $rows['webaddress']; ?></a> </td> </tr> <?php } mysql_close(); ?> </table> i need the startdate and enddate to be written as stated before Link to comment https://forums.phpfreaks.com/topic/105672-solved-print-date-in-a-more-user-friendly-format/#findComment-541438 Share on other sites More sharing options...
Barand Posted May 15, 2008 Share Posted May 15, 2008 <?php while($rows=mysql_fetch_array($result)){ $startdate = date('jS F y', strtotime($rows['startdate'])); $enddate = date('jS F y', strtotime($rows['enddate'])); ?> in the table, output $startdate and $enddate instead of $rows['startdate] and $rows['enddate'] Link to comment https://forums.phpfreaks.com/topic/105672-solved-print-date-in-a-more-user-friendly-format/#findComment-541444 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.