1、timestamp也是测过的,结果是一样的,后面才改成varchar的 2、上面的例子后面就是贴测试结果
|
1、timestamp也是测过的,结果是一样的,后面才改成varchar的
2、上面的例子后面就是贴测试结果 插入时间是:2020-09-09 15:25:55.416 插入后结果: local_dtm | curr_dtm | local_dtm_no_zone | curr_dtm_no_zone | ------------------------ | ------------------------ | ------------------------ | ------------------------ | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 | CREATE TABLE `sink2` ( `local_dtm` varchar(100) DEFAULT NULL, `curr_dtm` varchar(100) DEFAULT NULL, `local_dtm_no_zone` varchar(100) DEFAULT NULL, `curr_dtm_no_zone` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 drop table if exists sk; CREATE TABLE sk ( local_dtm TIMESTAMP, curr_dtm TIMESTAMP, local_dtm_no_zone TIMESTAMP WITHOUT TIME ZONE, curr_dtm_no_zone TIMESTAMP WITHOUT TIME ZONE ) WITH ( 'connector' = 'jdbc', 'url' = 'jdbc:mysql://10.12.5.37:3306/rs_report?useUnicode=true&amp;characterEncoding=UTF-8', 'table-name' = 'sink2', 'driver' = 'com.mysql.jdbc.Driver', 'username' = 'dps', 'password' = 'dps1234' ); insert into sk values(localtimestamp,current_timestamp,localtimestamp ,current_timestamp); 插入时间是:2020-09-09 15:25:55.416 插入后结果: local_dtm | curr_dtm | local_dtm_no_zone | curr_dtm_no_zone | ------------------------ | ------------------------ | ------------------------ | ------------------------ | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 | 2020-09-09 02:25:55.416 | 2020-09-08 18:25:55.416 | ------------------ 原始邮件 ------------------ 发件人: "xuzh" <[hidden email]>; 发送时间: 2020年9月10日(星期四) 晚上10:01 收件人: "xbjtdcq"<[hidden email]>;"user-zh"<[hidden email]>; 主题: Re:Re: localtimestamp和current_timestamp插入mysql时区错乱 1、timestamp也是测过的,结果是一样的,后面才改成varchar的 2、上面的例子后面就是贴测试结果 |
Free forum by Nabble | Edit this page |