Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
my source is an excel sheet where I have a column which is obviously a date, so in the schema in talend I defined that column as date.
In tMap I want to convert it to a string so I do --> TalendDate.formatDate("dd-MM-yyyy", row1.mydate) and get the following error :
java.lang.NullPointerException
at java.util.Calendar.setTime(Calendar.java:1770)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)
at java.text.DateFormat.format(DateFormat.java:345)
at routines.TalendDate.formatDate(TalendDate.java:129)
I tried several date patterns but it makes no difference.
Thanks in advance!
@Hendrik Molitor , can you try to use the below one.
row1.mydate==null?null:TalendDate.formatDate("dd-MM-yyyy", row1.mydate)
Thanks,
Manohar
Oh...i thought I excluded null value rows but obviously I didn`t...so this helps a lot 🙂
Thanks!!!
@Hendrik Molitor , you can mark the replay as Answer and like it, the one which helped you . So that it will help to others.
Thanks,
Manohar