From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

tConvertType changes the value of date fields when parsing string

One Star

tConvertType changes the value of date fields when parsing string


Talend Enterprise Big Data (5.4.1.r111943)
jdk 1.6.0_45
Windows 7

Problem description:
I'm using the tConvertType component to parse a string from a source database into a Date object. Depending on what data format string I use, the value of the date is changed.
I recreated this issue in a simple job to show the problem in isolation. I've attached the job here as and screenshots highlighting the important areas as example_screenshots.png.

As shown in, the input is the string "2014-10-09T14:58:34359699Z" but the output is "2015-11-11T07:19:39" when the format string "yyyy-MM-dd'T'HH:mm:ss" is used. 
The field date_2 holds a second copy of the same input string and shows that it is preserved when the format string "yyyy-MM-dd HH:mm:ss" is used. 

Secondary issue
When the format string "yyyy-MM-dd HH:mm:ss" is used (attempting to work around the problem), strings not matching the format string throw a NumberFormatException. For example, for the string "string", Talend attempts to parse the first 4 characters "stri" as the year. The result is the message below (table from a tLogRow attached to the tConvertType rejects output).  This seems inconsistent with the behaviour I've seen before where the row would be sent to rejects without raising an unhandled exception.

java.lang.NumberFormatException: For input string: "stri"
at java.lang.NumberFormatException.forInputString(
at java.lang.Integer.parseInt(
at java.lang.Integer.parseInt(
at routines.system.FastDateParser$DateTimeParser.parse(
at java.text.DateFormat.parse(
at routines.TalendDate.parseDate(
at routines.system.TypeConvert.String2Date(
at pdwserver.test_brokendateformat_0_1.test_brokenDateFormat.tFixedFlowInput_1Process(
at pdwserver.test_brokendateformat_0_1.test_brokenDateFormat.runJobInTOS(
at pdwserver.test_brokendateformat_0_1.test_brokenDateFormat.main(
|                                    #1. tLogRow_2                                     |
| key          | value                                                                 |
| date         | 2015-11-11T07:19:39                                                   |
| date_2       | null                                                                  |
| errorCode    | 2                                                                     |
| errorMessage | date_2:java.text.ParseException: Unparseable date: "string" - Line: 0 |

Re: tConvertType changes the value of date fields when parsing string

Java does not support six and only support the millisecond sss.
If you want to show six, write SSSSSS and the other will be Auto completed with  "000".
For example, the input is:
17-APR-12 AM
17-APR-12 AM

Best regards
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.


Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences


Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now