Kleines Snippet um Unix Timestamps in einer Tabelle in Datetime umzuwandeln
|
1 2 3 4 |
ALTER TABLE `table1` CHANGE `time` `unix_time` int(11) NOT NULL /* rename the old column */ ALTER TABLE `table1` ADD `time` DATETIME NOT NULL /* create the datetime column */ UPDATE `table1` SET `time`=FROM_UNIXTIME(unix_time) /* convert the data */ ALTER TABLE `table1` DROP `unix_time` /* drop the old unix time column */ |