PDA

View Full Version : Formating dates


dandy
05-04-2007, 12:00 PM
Hi,

Thanks for the tutorials - found them to be a great starting place for a complete newbie. Following the code from the beginners PHP tutorial but I'm stuck trying to format my dates. I follow the tutorial syntax almost exactly and I'm trying to format the date. My code is:

$query = sprintf("SELECT * FROM bookings ORDER BY bl_datefor, bl_reference");
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);

do {
echo "<tr>";
/////////////////////////////////my attempt to format a date
echo "<td>".date("d-m-y", $row['bl_datefor'])."</td>";
echo "<td>".$row['bl_reference']."</td>";
echo "<td>".$row['bl_supplier']."</td>";
echo "<td>".$row['bl_givento']."</td>";
echo "<td>".$row['bl_takenby']."</td>";
echo "<td>".$row['bl_dategiven']."</td>";
echo "<td>".$row['bl_pieces']."</td>";
echo "<td>".$row['bl_orders']."</td>";
echo "</tr>";
} while ($row = mysql_fetch_array($result))
?>

When I try to format the date they all come out at 01-01-70. Anyone know an easy (perhaps global) way to fix this?