// 获取当前时间
public static String getNowDate() {
Date date = new Date();
DateFormat format = new SimpleDateFormat("yyyy/MM/dd");
String time = format.format(date);
return time;
}
// 判断输入时间是否大于当前时间
public static boolean isTrueDate(String inputDateStr) {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd ");
Date currTime = df.parse(df.format(new Date(System.currentTimeMillis())));
Date inputDate = df.parse(inputDateStr);
if (inputDate.after(currTime)) { //before
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
Utils-date
最新推荐文章于 2023-05-26 10:44:37 发布