date conversion issue

One Star

date conversion issue

Good morning,
I would like to generate a file that contains dates like this pattern DD / MM / YYYY but when generating the query with component tOracleInput with the date that I have the following form : Tue Oct 23 00:00:00 CEST 2008 .. I realize therefore to_char (date, 'DD / MM / YYYY HH24: MI: SS') in the tOracleInput and I get the following exception:
Except in Component tOracleInput_1
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh: mm: ss.fffffffff
at java.sql.Timestamp.valueOf (Unknown Source)
at oracle.jdbc.driver.CharCommonAccessor.getTimestamp (CharCommonAccessor.java: 485)
Could you help me ?
Thank you.
Community Manager

Re: date conversion issue

Hello
Set the data type of 'date' column as String when defining the schema of tOracleInput component, then link to a tMap/tJavaRow, convert this string to a date:
TalendDate.parseDate("EEE MMM dd HH:mm:ss zzzz yyyy",row1.date)

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business