Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue in converting Date format yyyy to int

There is a mySQL variable in "YEAR" datatype i.e. present in "yyyy" and I would like to convert it as int through Talend.

I use tMap with expression function formatDate to convert the type as str and then use tConvertType compo to convert the str as int. When I look up the result by tLogRow. the variable is unable to represent with error java.text.ParseException: Unparseable date: "2004". How can I solve the issue?

Labels (3)
2 Replies
David_Beaty
Specialist
Specialist

Assuming you have the correct syntax of TalendDate.formatDate(), are you sure the year column is on the database as a date type and the schema within Talend is a date time?

 

Thanks

 

David

Anonymous
Not applicable
Author

Check to make sure the input is a valid date format then use.

 

TalendDate.getPartOfDate("YEAR",yourdate)

 

This returns an INT type without the need of the tconverttype