On my website I want to store user's action as a timestamp in my database (so in a bigint type).
I use the php function time().
$date = time();
When I print $date
, everything is fine.
But when I store $date
in my database (mysql database), I get an incredible value.
I just did it and the value i get is: 20180610051606
which represent the year 641468
!!!!
I don't understand what's wrong.
Update:
When I use int type to store the variable $date
in the database the value that is stored is 4294967295
Here is my code:
$date = time();
$query = $db->prepare("INSERT INTO table (id,date) values(?, ?)");
$query->execute(array($id, $date));