The problem here is that i have the following code:
String newPattern = "yyyy-MM-dd HH:mm:ss.SSS";
SimpleDateFormat formatterDB = new SimpleDateFormat(newPattern);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String nDate1 = rs.getString("FromDate");
String nDate2 = rs.getString("ToDate");
Date newDate1 = formatterDB.parse(nDate1);
Date newDate2 = formatterDB.parse(nDate2);
Date sd = formatter.parse("2013-08-22");
Date ed = formatter.parse("2013-08-24");
Date exd = formatter.parse("2013-08-23");
The first condition to be verified is that exd lies between [sd,ed] and if true then exd should also lie between [newDate1,newDate2] and if this is true then other elements from the dB will be fetched.
Please not that the source of both dates are different, one date is from the dB having a different format entirely whereas the other date is being given as a String input and they need to be compared, so they have got different format.
To make it more clear, here is an example:
I gave input for
exdas 2013-08-23 the input forsdandedis given thenewDate1is 2013-08-28(in dB format) andnewDate2is 2013-09-01(in dB Format) Still it accepts the inputexdand fetches the other column.
** I have snipped the relevant code, for any issues, drop in a comment. Any Help is appreciated. Thanks in Advance!