UNIX Timestamp to MySQL DATETIME
Posted
by Henk Denneboom
on Stack Overflow
See other posts from Stack Overflow
or by Henk Denneboom
Published on 2009-08-15T13:03:13Z
Indexed on
2010/04/27
2:53 UTC
Read the original article
Hit count: 476
Hi all,
I have a table with statistics and a field named time with Unix Timestamps.
There are about 200 rows in the table, but I would like to change the Unix timestamps to MySQL DATETIME.
Without losing the current rows.
What would be the best way to update the Unix Timestamp to MySQL's DATETIME?
The current table:
CREATE TABLE `stats` (
`id` int(11) unsigned NOT NULL auto_increment,
`time` int(11) NOT NULL,
`domain` varchar(40) NOT NULL,
`ip` varchar(20) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`domain_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
So the time
(INT) should be a DATETIME field.
Thanks in advance!
© Stack Overflow or respective owner