Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Please advise me below. Thanks
I would like to deliver the report showing ETA>=5/1/2019. Currently ETA is a string data type and date in ETA column has empty value or date format like 5/1/2019, 3/24/2019, 12/13/2017.
I was trying below syntax but I got Unparseable date error such as "2019-03-12" but I looked at my data and I did not find date like that format.
TalendDate.compareDate(TalendDate.parseDate("MM/dd/yyyy",row1.ETA),TalendDate.parseDate("MM/dd/yyyy","5/1/2019"))>=0
Your code worked fine for me with the data you provided.
Screenshot of my test job showing the fixed input with your test data:
Contents of the tJavaRow component:
int compare = TalendDate.compareDate(TalendDate.parseDate("MM/dd/yyyy",row1.ETA),TalendDate.parseDate("MM/dd/yyyy","5/1/2019")); System.out.println(row1.ETA + ":" + compare);
Output:
Starting job TestDate at 23:55 03/05/2019. [statistics] connecting to socket on port 3424 [statistics] connected 5/1/2019:0 3/24/2019:-1 12/13/2017:-1 [statistics] disconnected Job TestDate ended at 23:55 03/05/2019. [exit code=0]
You should check your data input to make sure it does not contain that unexpected date value that you showed.
I am also attaching the zip archive of the test job.
I suspect that somewhere in your data there is a poorly formatted String date. Can you give a screenshot of your job so that it can provide a few clues?