ohsnyder 04:13:12 | Can someone set me straight on what I am doing wrong in formatting the date output ? I am trying to get Apr 13, 2012 14:25 but it prints 2012-04-13 00:00:00 The Data Base Column is set: 'type' = timestamp and 'default' =CURRENT_TIMESTAMP I don't want the user to have to enter a date but rather the input should default to the current date & time when the record is saved. <?php include("menu.php"); $con = mysql_connect("localhost","********","********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mdwvo_aaba", $con); $result = mysql_query("SELECT * , DATE_FORMAT(date, '%b %e, %Y %k:%i') FROM forsale WHERE sold ='N'"); Print "<table align=center width=100%"; Print "<tr><th align=center><h2>Items For Sale</h2></th>"; Print "<table align=center width=100% cellpadding=3>"; Print "<tr><th align=left>Item</th><th align=left>Image</th><th align=left>Quantity</th><th>Condition</th><th>Deliver/Pick Up</th><th>Pick Up Price</th><th>Delivered Price</th><th>Contact</th><th>Date</th></tr>"; while($row = mysql_fetch_array($result)) { "<tr><td>".$row['description'] . "</td> <td>".$row['image'] . "</td> <td align=center>".$row['quantity'] . " </td> <td align=center>".$row['condition'] . " </td> <td align=center>".$row['ship'] . " </td> <td align=center>".$row['puprice'] . " </td> <td align=center>".$row['delprice'] . " </td> <td align=center>".$row['contact'] . " </td> <td align=center>".$row['date'] . " </td></tr>"; } Print "</table>"; mysql_close($con); ?> |
smo1234 04-15-2012 | Read this Date format |