Java Code:
private void cmdCalculateActionPerformed(java.awt.event.ActionEvent evt) {                                             
   
String datetoday;

DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
       
int modifier = 0;
Date d1;
Date d1last;
Date d1normal;
Date d1discount;


Date d2;
Date d2last;
Date d2normal;
Date d2discount;

Date d3;
Date d3last;
Date d3normal;
Date d3discount;

Date d4;
Date d4last;
Date d4normal;
Date d4discount;

Date todaysdate;     
 
datetoday = new SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date());
     
try {
    todaysdate = df.parse(datetoday);
    d1 = df.parse("2007-01-01");
    d1last = df.parse("2007-03-31");
    d1normal = df.parse("2007-03-15");
    d1discount = df.parse("2007-03-24");
    
    
    
    d2 = df.parse("2007-04-01");
    d2last = df.parse("2007-06-30");
    d2normal = df.parse("2007-06-15");
    d2discount = df.parse("2007-06-23");
    
    
    d3 = df.parse("2007-07-01");
    d3last = df.parse("2007-09-30");
    d3normal = df.parse("2007-09-15");
    d3discount = df.parse("2007-06-23");
    
    
    d4 = df.parse("2007-10-01");
    d4last = df.parse("2007-12-31");
    d4normal = df.parse("2007-12-16");
    d4discount = df.parse("2007-06-24");
   
    
    
} catch(java.text.ParseException pe) {
    JOptionPane.showMessageDialog(null, "like parse error");
   return;
}

String relation;
String date1 = d1.toString(); 
String date2 = d2.toString(); 
String date3 = d3.toString(); 
String date4 = d4.toString(); 
String date1last = d1last.toString();
String date2last = d2last.toString();
String date3last = d3last.toString();
String date4last = d4last.toString();



 if (((todaysdate.equals(d1)) | (todaysdate.after(d1))) && ((todaysdate.equals(d1last)) | (todaysdate.before(d1last))))
             {
        relation = ("Date is in the first Quarter");
    LblPrevious.setText(date4last);
    LblCurrent.setText(date4last);
             }
   else if (((todaysdate.equals(d2)) | (todaysdate.after(d2))) && ((todaysdate.equals(d2last)) | (todaysdate.before(d2last))))
             {
   relation = ("Date is in the second Quarter");
LblPrevious.setText(date1last);
LblCurrent.setText(date2last);
             }
  else if (((todaysdate.equals(d3)) | (todaysdate.after(d3))) && ((todaysdate.equals(d3last)) | (todaysdate.before(d3last))))
             {
    relation = ("Date is in the third Quarter");
    LblPrevious.setText(date2last);
    LblCurrent.setText(date3last);
             }
       else if  (((todaysdate.equals(d4)) | (todaysdate.after(d4))) && ((todaysdate.equals(d4last)) | (todaysdate.before(d4last))))
             {
        relation = ("Date is in the fourth quarter");
        LblPrevious.setText(date3last);
        TxtOutput.setText(todaysdate + " is " + relation );
        LblCurrent.setText(date4last); 
             }
       else   if (todaysdate.equals(d1discount))
    {
                      JOptionPane.showMessageDialog(null, "discounted", "zxczxczc", JOptionPane.ERROR_MESSAGE);
    
     }
               relation = ("Date is in the fourth quarter");
            LblPrevious.setText(date3last);
              LblCurrent.setText(date4last);

The above works by dectecting which quarter of the year the user by comparing preset dates with todays date. Unfortunately when I tried to test it on other dates for example the "d1discount" date to throw up an errror message it just didnt work it wasnt able to compare the varaible todaysdate to d1discount, even when I set the value of todaysdate to the same as d1discount it won't be able to catch the day why is this.