import java.text.SimpleDateFormat;
import java.util.Date;
public class Test
{
public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static void compare_Date(Date EffectiveStartDate){
Date dtCurrent=new Date();
String EffectiveStart_Date = sdf.format(EffectiveStartDate);
String dtCurrent_Date = sdf.format(dtCurrent);
if(EffectiveStart_Date.compareTo(dtCurrent_Date) >= 0)
{
System.out.println("effective date >= current date");
}
else
{
System.out.println("effective date < current date");
}
}
public static void main(String[] args) {
Date EffectiveStartDate = new Date();
compare_Date(EffectiveStartDate);
}
}
评论