我从一个文本中获取开始日期,并存储在一个字符串变量中。我想将开始日期与当前日期进行比较,即开始日期是否早于当前日期。
public static void main(String[] rags) throws ParseException{
String total= "I am Going to join in scholl at 21/10/2108";
String[] effectiveDateText=total.split(" ");
String effectiveDate=effectiveDateText[effectiveDateText.length-1];
System.out.println(effectiveDate);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Calendar today = Calendar.getInstance();
String todate=sdf.format(today.getTime());
System.out.println(todate);
if(effectiveDate<todate){
System.out.println("effective date is less then the previous date");
}
https://stackoverflow.com/questions/52778751
复制相似问题