Talend parse Date “yyyy-MM-dd'T'HH:mm:ss'.000Z'”

*爱你&永不变心* 提交于 2021-01-28 05:09:08

问题


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'"

I have a tMap with this connection

TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'.000Z'",Row1.firstDate)

but is throwing the following error:

java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2008-05-11T12:02:46.000+0000" at routines.TalendDate.parseDate(TalendDate.java:895)

Any help? Thanks


回答1:


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.

You can try :

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.




回答2:


Try this,

TalendDate.parseDate("MM/dd/yyyy",'T'HH:mm:ss',Row1.firstDate);



来源:https://stackoverflow.com/questions/43755262/talend-parse-date-yyyy-mm-ddthhmmss-000z

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!