Jump to content

[SOLVED] Print date in a more user friendly format


dachshund

Recommended Posts

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

 

<?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']

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.