Search code examples
salesforcetalend

Talend parse Date "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'"

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


Solution

  • 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.enter image description here