PHP Code:
$db->query_write("
INSERT INTO table_name
(user, message, date)
VALUES (
'" . $db->escape_string($username) . "',
'" . $db->escape_string($message) . "',
'" . $db->escape_string($date) . "'
)
");
You probably won't have to escape $date though (you should be saving it as a Unix timestamp).
Edit: instead of using raw $_POST values, use vBulletin's cleaning functions (read more here:
https://vborg.vbsupport.ru/showthread.php?t=98047).