Unparseable Date error - Talend

陌路散爱 提交于 2019-12-13 20:42:53

问题


I am trying to copy data from Excel to a SQL table.

I have dates generated in Excel file using RAND function. I am taking them as strings in an input and trying to convert them in date data type using tConvertType.

I have setted its datatype as 'string' in initial input and as 'date' in tConvertType's output and in tMSSqlOutput.

My job has work flow Excel input -> tConvertType -> tMap -> tMSSqlOutput. While running the job I am getting an error which says : java.text.ParseException: Unparseable date: "Tue Jul 17 00:00:00 EDT 1973"

I am not sure where the problem lies. If anyone could help me with this it would be much appreciated.

Here's the screenshot of my job.


回答1:


i am able to parse your given sample date please use below function in tMap for your date filed.

System.out.println(TalendDate.parseDateLocale("EEE MMM dd HH:mm:ss zzz yyyy", 'Tue Jul 17 00:00:00 EDT 1973', "EN"));

function is yourDateColumn!=null && !"".equalsIgnoreCase(yourDateColumn)? TalendDate.parseDateLocale("EEE MMM dd HH:mm:ss zzz yyyy", yourDateColumn, "EN") :null




回答2:


@UmeshR: your code is working fine, but you have to handle the timezone thing as well. e.g. I am from India and when i converted the time from EDT talend converted it to my local timezone. see the screen-shot

.

来源:https://stackoverflow.com/questions/23920933/unparseable-date-error-talend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!