How to compare two dates when they are coming in the String format?

0

I want to know for suppose I have a date '10/FEB/2014' and I want to compare it to '15/02/2014'

Both of the dates are in String format and they have diffferent formats I want to know which one is a greater date ? 

shaunakatdalal's picture
Joined: Apr 27 2016 - 11:32pm
Last seen: 2 years 11 months ago

3 Answers:

0

This is just a very simple Java problem. Suggest that you learn Java before trying to use JasperReports.
((new SimpleDateFormat("dd/MM/yyyy")).parse("15/02/2014")).after(((new SimpleDateFormat("dd/MMMM/yyyy",Locale.ENGLISH)).parse("10/FEB/2014")))

hozawa's picture
51278
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
0

its not working its giving me a compilation error at first .parse

shaunakatdalal's picture
Joined: Apr 27 2016 - 11:32pm
Last seen: 2 years 11 months ago
0

I forgot to mention, Expression Editor in Jaspersoft Studio is buggy and sometimes returns error when there is none.

Just save the expression and preview to execute.

hozawa's picture
51278
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
Feedback