public class DateUtils {
//使工具类方法私有化,只传递一个简化的方法,降低耦合
private static String getOneWeek(Calendar cdate,Calendar cdateNew){
cdate.add(Calendar.DATE, 7);
if(cdate.getTimeInMillis()>cdateNew.getTimeInMillis()){
System.out.println("小于1周");
return null;
}
else if(cdate.getTimeInMillis()==cdateNew.getTimeInMillis())
return "一周";
else if(cdate.getTimeInMillis()<cdateNew.getTimeInMillis()){
cdate.add(Calendar.DATE, -7);
return getOneMonth(cdate,cdateNew);
}
return null;
}
private static String getOneMonth(Calendar cdate,Calendar cdateNew){
cdate.add(Calendar.MONTH, 1);
if(cdate.getTimeInMillis()>cdateNew.getTimeInMillis()){
System.out.println("小于1月");
return null;
}
else if(cdate.getTimeInMillis()==cdateNew.getTimeInMillis())
return "一个月";
else if(cdate.getTimeInMillis()<cdateNew.getTimeInMillis()){
cdate.add(Calendar.MONTH, -1);
return getThreeMonth(cda
java判断员工入职时间工具类
最新推荐文章于 2024-08-13 11:47:14 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)