目标数据格式
binlog监听获取的日期为 2022-07-26T16:55:03.000+00:00
这种日期格式为:yyyy-MM-dd'T'HH:mm:ss.SSS
后面应该还需要有pattern,但是我们到秒就可以了
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
try {
System.out.println(sdf.format(sd.parse("2022-07-26T16:55:03.000+00:00")));
} catch (ParseException e) {
e.printStackTrace();
}
最后效果为:2022-07-26 16:55:03