Talend 解析日期“yyyy-MM-dd'T'HH:mm:ss'.000Z'" [英] Talend parse Date "yyyy-MM-dd'T'HH:mm:ss'.000Z'"
问题描述
我在 Talend 中解析日期时出错.我的输入是字符串形式的 excel 文件,输出是具有以下 Salesforce 格式yyyy-MM-dd'T'HH:mm:ss'.000Z'"的日期
I have an error parsing a date in Talend. My input is an excel file as String and my output is a Date with the following Salesforce format "yyyy-MM-dd'T'HH:mm:ss'.000Z'"
我有一个带有这个连接的 tMap
I have a tMap with this connection
TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'.000Z'",Row1.firstDate)
TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'.000Z'",Row1.firstDate)
但抛出以下错误:
java.lang.RuntimeException: java.text.ParseException: 无法解析日期:2008-05-11T12:02:46.000+0000"在routines.TalendDate.parseDate(TalendDate.java:895)
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2008-05-11T12:02:46.000+0000" at routines.TalendDate.parseDate(TalendDate.java:895)
有什么帮助吗?谢谢
推荐答案
在 TalendDate.parseDate 中,参数pattern"必须匹配输入字符串的模式,而不是您想要在输出中的日期模式.
In TalendDate.parseDate, the parameter "pattern" must match the pattern of the input String, and not the pattern of the Date you want in the output.
你可以试试:
TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'.000+0000'",Row1.firstDate )
日期输出的格式可在模式"菜单的日期模型"列中访问.
Formatting of Date output is accessible in the 'schema' menu, in "Date Model" column.
这篇关于Talend 解析日期“yyyy-MM-dd'T'HH:mm:ss'.000Z'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!