Your problem is that the T
in your Local Date time
makes the value incompatible with MySQL's DATETIME
or TIMESTAMP
columns. However you can work around that using either STR_TO_DATE
to convert the format, or using REPLACE
to replace the T
with a space (thus making it a MySQL compatible datetime). For example:
create table test (d datetime, t timestamp);
insert into test values
(str_to_date('2007-01-01T00:25:47', '%Y-%m-%dT%H:%i:%s'), str_to_date('2007-01-01T00:25:47', '%Y-%m-%dT%H:%i:%s')),
(replace('2007-01-01T00:25:47', 'T', ' '),replace('2007-01-01T00:25:47', 'T', ' '));
select * from test
Output:
d t
2007-01-01 00:25:47 2007-01-01 00:25:47
2007-01-01 00:25:47 2007-01-01 00:25:47
Demo on dbfiddle