You need to make a new column in your database table as int(11).
Then, when your script inserts the comment, use the PHP time() function as the data for that column.
Then, when you display your column, use the PHP date() function to format the timestamp.
Example:
Insert PHP Code:
<?php
$name = $_POST['name'];
$comment = $_POST['comment'];
$sql = mysql_query ("INSERT INTO comments (id,name,comment,date) VALUES (0,'".$name."','".$comment."','".time()."')");
?>
Display PHP Code:
<?php
$sql = mysql_query ("SELECT * FROM comments");
while ($row = mysql_fetch_array ($sql)) {
echo 'Name: '.$row['name'].'<br />Comment: '.$row['comment'].'<br />Date: '.date('M/d/Y h:i A', $row['date']);
}
?>
The above would display something like:
Name: My name
Comment: My comment
Date: 05/01/2009 01:30 AM
You can change the way it is formatted by changing the date() parameters. See a list of parameters
here.
Hope that helps.