How to change the field type from integer to datetime with automatic conversion of values?

Tell me, is the database date_of_birth field type is specified as integer, and all the dates in it as a number unixtimestamp

I need to change the field type to datetime
If you do
ALTER TABLE tablename MODIFY date_of_birth DATETIME;
gives an error invalid value

There are some solution for automatic convert date from integer in the form of a datetime in the table?
June 3rd 19 at 19:21
2 answers
June 3rd 19 at 19:23
Solution
mysql is not able to convert values when changing the type is incompatible.
So you need to add a new field, update entire table, delete the old field and rename the new to the old.

To convert from unixtime to datetime numeric is a suitable function FROM_UNIXTIME, so the update of the table will be:
update tablename set new_datefield = FROM_UNIXTIME(old_int_unixtime);
June 3rd 19 at 19:25
As an option:
1. Add a new field
2. UPDATE'om to transfer the value in the desired format
3. To demolish the old field
4. Rename new field to old

Find more questions by tags MySQL