0
I generate a date in PHP and saved in the database:
$today = date('Y-m-d H:i:s');
$timestamp = strtotime($today);
In the bank she is saved in this format: 1474496101
When I make a SELECT in this field using the query below for example, DO NOT RETURN ANYTHING.
SELECT * FROM teste.data WHERE data = FROM_UNIXTIME(1474496101)
someone can tell me why ?
And how the column is defined
data
in the database?– Woss
sorry I had to edit pq missing a sentence. the date field is int type
– Phazzigm Master
The table name is
teste.data
even?– Woss
bank calls test and the date table and the date field
– Phazzigm Master
Right. What if the kind of
data
isint
, why compare the value of the column with the return ofFROM_UNIXTIME
? Shouldn’t bedata = 1474496101
?– Woss
Friend you can pick up the current date directly by the bank. Use the now function()
– Andre
I think you’re right, to use the FROM_UNIXTIME field type should be TIMESTAMP, correct? it was innocence at the time of creating the bank.
– Phazzigm Master
I want to use the graph to make the graph and it only accepts the query with FROM_UNIXTIME..
– Phazzigm Master
does not work I changed the field to TIMESTAMP it went to format 0000-00-00 00:00:00
– Phazzigm Master