kettle报错couldn't convert string [1970-01-01 00:00:00] to a date using format [yyyy/MM/dd HH:mm:ss.SSS]

1.报错如下


2019/01/08 12:04:18 - 替换NULL值.0 - ERROR (version 8.1.0.0-365, build 8.1.0.0-365 from 2018-04-30 09.42.24 by buildguy) : Error in step :
2019/01/08 12:04:18 - 替换NULL值.0 - effect_date String : couldn't convert string [1970-01-01 00:00:00] to a date using format [yyyy/MM/dd HH:mm:ss.SSS] on offset location 4
2019/01/08 12:04:18 - 替换NULL值.0 - 1970-01-01 00:00:00
org.pentaho.di.core.exception.KettleValueException:
effect_date String : couldn't convert string [1970-01-01 00:00:00] to a date using format [yyyy/MM/dd HH:mm:ss.SSS] on offset location 4
1970-01-01 00:00:00
at org.pentaho.di.core.row.value.ValueMetaBase.convertStringToDate(ValueMetaBase.java:925)
at org.pentaho.di.core.row.value.ValueMetaBase.getDate(ValueMetaBase.java:2271)
at org.pentaho.di.core.row.value.ValueMetaBase.convertData(ValueMetaBase.java:3813)
at org.pentaho.di.trans.steps.ifnull.IfNull.replaceNull(IfNull.java:235)
at org.pentaho.di.trans.steps.ifnull.IfNull.updateFields(IfNull.java:203)
at org.pentaho.di.trans.steps.ifnull.IfNull.processRow(IfNull.java:167)
at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.text.ParseException: 1970-01-01 00:00:00
at org.pentaho.di.core.row.value.ValueMetaBase.convertStringToDate(ValueMetaBase.java:916)
... 7 more


2.报错原因

这个报错原因很好理解:couldn't convert string [1970-01-01 00:00:00] to a date using format [yyyy/MM/dd HH:mm:ss.SSS。这句话说得就是:不能使用格式[yyyy/MM/dd HH:mm:ss.SSS]字符串[1970-01-01 00:00:00] 转换成一个date。即转换格式不对。


3.修改办法

3.1 替换NULL值组件

1.png

3.2 转换掩码

默认转换 date 和 Timestamp 的转换掩码没有填写,根据自己的需要填写一个模式即可。

PS:请注意自己的日期格式对应的类型

2.png


————————————————

版权声明:本文为CSDN博主「LittleLawson」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/liu16659/article/details/86071707

欢迎留言