Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Invalid Date Input for DB2

Hi,
I am having a simple job to write XML file contents into a Database table (DB2) , current data type for the xml field is Date and the format is "yyyy-MM-ddTHH:mm:ss" , the column's type is Date in the database table. When we write the data into the DB table I have this DB errror : Unparseable date: "2014-02-23T00:00:00"
I tried to formatt the date with Expressions in th tMapEditor like below but I have an error type equivalence;
"Type mismatch: can not convert string to a date"
0683p000009MDzm.png
Labels (3)
13 Replies
Anonymous
Not applicable
Author

I tried to fix the error with tJavaRow componenet writing this code :
Date dteSoldeDT = TalendDate.parseDate("yyyy-MM-ddTHH:mm:ss", input_row.DteSolde); 
Integer dd = TalendDate.getPartOfDate("dd",dteSoldeDT);
Integer MM = TalendDate.getPartOfDate("MM",dteSoldeDT);
Integer yyyy = TalendDate.getPartOfDate("yyyy",dteSoldeDT);
output_row.DteSolde = TalendDate.parseDate("dd-MM-yyyy", dd.toString()+"-"+MM.toString()+"-"+yyyy.toString());

Knowing that the type of the field is String in the Input row and Date (format dd-MM-yyyy)in the tMap component.
But I still have the same problem..
Unparseable date: "2014-02-23T00:00:00"
Below a screenshot which describes the modificaton
0683p000009MDW2.png
Anonymous
Not applicable
Author

Just another comment; The Date fields in the xml file are all written in this format :
<DteSolde>2014-02-24T13:37:11</DteSolde>
Anonymous
Not applicable
Author

Hi,
First line of parsing is not required... Remove that.. it should be Ok.
Integer dd = TalendDate.getPartOfDate("dd",input_row.DteSolde);
Integer MM = TalendDate.getPartOfDate("MM",input_row.DteSolde);
Integer yyyy = TalendDate.getPartOfDate("yyyy",input_row.DteSolde);
output_row.DteSolde = TalendDate.parseDate("dd-MM-yyyy", dd.toString() "-" MM.toString() "-" yyyy.toString());
output_row.DteSolde - is your final transformed date...
Also refer to discussion at https://community.talend.com/t5/Design-and-Development/resolved-UnParseable-Date-format/td-p/114070
This also hints about the new way of transforming date using DateFormat
Check if it is ok.
Vaibhav
Anonymous
Not applicable
Author

thanks for your help