Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a date(String data type) column in excel file , values are in 2 formats 'dd.MM.yyyy' and 'dd/MM/yyyy'.
I am trying to convert this string type to date using TalendDate.parseDate("dd/MM/yyyy",row2.date).
How am I supposed to use TalendDate.parseDate() for both the date formats within tMap at once?
Right now I am getting Unparseable date format exception since I am unable to handle this using 'dd/MM/yyyy' format. Please refer below for further details -
Exception in component tMap_10
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "21.08.2018"
at routines.TalendDate.parseDate(TalendDate.java:892)
at routines.TalendDate.parseDate(TalendDate.java:836)
Hi,
If you are sure that the date values will come only in above two formats, the easiest way will be to replace the character.
Relational.ISNULL(row1.input_date)? null:TalendDate.parseDate("dd/MM/yyyy",row1.input_date.replace(".","/"))
Could you please try this code in tmap and let us know whether it helped to resolve your issue.
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Hi fdenis,
I had already applied all the approaches you have mentioned. Is there no other way to parse the Date column
for both the formats as discussed above i.e., within tMap itself?
Please let me know if you need any additional information from my end.
Thanks in advance!
Hi fdenis,
I still couldn't figure out the exact process. Could you please explain in a bit illustrative way?
Thanks in advance!
Hi,
If you are sure that the date values will come only in above two formats, the easiest way will be to replace the character.
Relational.ISNULL(row1.input_date)? null:TalendDate.parseDate("dd/MM/yyyy",row1.input_date.replace(".","/"))
Could you please try this code in tmap and let us know whether it helped to resolve your issue.
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Hi All,
Is there a way to parse the date from "dd.MM.yy" to "dd/MM/yyyy" ?