izbryte Posted November 18, 2007 Share Posted November 18, 2007 How do I format the date to 'm.d.y' within my results? <?php $query = "SELECT title, employer, location, date FROM jobs"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo " <tr> <td><b>{$row['title']}</b> <br>{$row['employer']}</td> <td>{$row['location']}</td> <td>{($row['date']}</td> </tr>"; } ?> Sorry if I'm a bonehead! Link to comment https://forums.phpfreaks.com/topic/77771-solved-easy-question-about-date-format/ Share on other sites More sharing options...
Barand Posted November 18, 2007 Share Posted November 18, 2007 Depends on what column type you defined for the date field Link to comment https://forums.phpfreaks.com/topic/77771-solved-easy-question-about-date-format/#findComment-393688 Share on other sites More sharing options...
izbryte Posted November 18, 2007 Author Share Posted November 18, 2007 DATETIME Link to comment https://forums.phpfreaks.com/topic/77771-solved-easy-question-about-date-format/#findComment-394079 Share on other sites More sharing options...
Barand Posted November 18, 2007 Share Posted November 18, 2007 echo date ('m.d.y', strtotime($row['date'])); Link to comment https://forums.phpfreaks.com/topic/77771-solved-easy-question-about-date-format/#findComment-394082 Share on other sites More sharing options...
izbryte Posted November 18, 2007 Author Share Posted November 18, 2007 thank you so much! Link to comment https://forums.phpfreaks.com/topic/77771-solved-easy-question-about-date-format/#findComment-394096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.