I would like to compare dates with before and after with the following code.
I have two variables varYEAR
and varYEARDAY
, and would like to compare them with "before" and "after".
If I save the code with Eclipse I got the following message:
The method before(String) is undefined for the type String
Sorry, I am a totally newcomer in java :-)
private void prepare_Data() throws Throwable {
// Please implement me
java.text.DateFormat df = new java.text.SimpleDateFormat("yyyyMMdd");
String date1 = df.format(varYEAR);
java.text.DateFormat df1 = new java.text.SimpleDateFormat("yyyyMMdd");
String date2 = df1.format(varYEARDAY);
if(date1.**before**(date2)) {
double dOAMT = Double.parseDouble(varOAMT);
OP = OP + dOAMT;
oOP = String.valueOf(OP);
}
if(date1.**after**(date2)){
double dOAMT = Double.parseDouble(varOAMT);
OPF = OPF+ dOAMT;
oOPF = String.valueOf(OPF);
}
}