5
I have a table in a Mysql database that has a date column VARCHAR
, guy 20-09-2017
and I need to migrate this column to a column bigint(8)
using the date format timestamp
unix.
How to do this?
5
I have a table in a Mysql database that has a date column VARCHAR
, guy 20-09-2017
and I need to migrate this column to a column bigint(8)
using the date format timestamp
unix.
How to do this?
4
UNIX_TIMESTAMP('2017-09-20 00:00:00')
If it is in another format, then you have to format it first:
STR_TO_DATE('20-09-2017', '%d-%m-%Y')
1
Follow the solution I used.
Converting from string to date:
Update `tabela`
set date = STR_TO_DATE(date_text, '%d/%m/%Y')
Converting from date to Unix timestamp:
Update `tabela`
set date_unix = UNIX_TIMESTAMP('date');
Browser other questions tagged mysql date timestamp unix
You are not signed in. Login or sign up in order to post.
In case, note that the solution is precisely what was posted in the other answer, is that it? It would be good to mark it as accepted to close the question.
– Bacco
The problem is when I asked the question I hadn’t registered yet. Now I can’t accept Maniero’s answer. Sorry by BO.
– Nathalia Negrão
If this is the case, you can signal the site’s team to merge their posts, if they can determine which ones are really yours. This way I believe you could get the "lost" score back; as for what happened, stay calm. No need to apologize, it was just a recommendation for a matter of organizing the site.
– Bacco