Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 

DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 


Date d1; 
Date d2; 
Date d3; 
Date d4; 
try { 
d1 = df.parse("2007-01-01"); 
d2 = df.parse("2007-04-01"); 
d3 = df.parse("2001-07-02"); 
d4 = df.parse("2001-09-02"); 
} catch(java.text.ParseException pe) { 
JOptionPane.showMessageDialog(null, "0"); 
return; 
} 

String relation; 
if (d1.before(d2)) 
relation = "Date is in the first Quarter"; 
else if (d1.after(d2)) 
relation = "Date is in the second Quarter"; 
else if (d2.before(d3)) 
relation = "Date is in the second Quarter"; 
else if (d2.after(d3)) 
relation = "Date is in the third Quarter"; 
else if (d3.before(d4)) 
relation = "Date is in the third Quarter"; 
else if (d3.after(d4)) 
relation = "Date is in the third Quarter"; 
else 
relation = "Date is in the fourth quarter"; 
TxtOutput.setText(d1 + " is " + relation + ' ' + d2 ); 


}

The above code detects the date for each variable and tells the user which quarter it is in displaying it in a text field.

I have one question concerning...


Code:
d1 = df.parse("2007-01-01"); 
d2 = df.parse("2007-04-01"); 
d3 = df.parse("2001-07-02"); 
d4 = df.parse("2001-09-02");

Is it possible to have some sort of TO option for example


Code:
d1 = df.parse("2007-01-01 *TO 2007-03-31*");


The idea is that i the end I will be able to compare todays date (the day in which the program is compiled i.e. not a a fixed day) with each quarter not just comparing quarters with each other, I also need help in this area too. Also is it possible to just select months instead of years bcause at present this program would only be compatible with this year instead of the "yyyy-MM-dd" format I could have a "MM-dd" format.