Calculate the difference of 30 days between the two times.
String statime = starttime.getText();
String endtim = endtime.getText();
if(!"".equals(statime)&&!"".equals(endtim)){
long startLong = stringToDate(statime).getTime() ;
long endLong= stringToDate(endtim).getTime();
int a = (int) ((endLong-startLong)/(24 * 60 * 60 * 1000));
if(a>=31){
MessageDialog.openConfirm(getShell (), "Tips", "The period between the two should be controlled within 1 month");
return;
}
}