i get error when i want to insert current time to my table-field date,
i get this error PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1345724717' for column 'date' at row 1: INSERT INTO {users_history} (uid, nid, points, date, reason) VALUES ('31', '107', '2', '1345724717', 'session'); Array ( ) in points_node_insert() (line 57 of /home/www/live_project/htdocs/sites/all/modules/custom/points/points.module).
i have table like this:
uid int
nid int
points int
date datetime
reason enum
this is my query(this query works fine if i delete date field)
$date = time();
db_query("INSERT INTO {users_history}
(uid, nid, points, date, reason) VALUES
('$uid', '$nid', '$points_for_post', '$date', '$reason')");