我正在尝试对日期进行验证,该日期应仅采用当前和未来日期,如果日期是旧日期则应显示
日期早于当天
我也想允许当前日期.现在正在给gievnDate作为当天,它总是显示
日期早于当天
但我期待输出为
日期是givenDate的未来日期.
以下是我一直在尝试的代码:
Date current = new Date();
String myFormatString = "dd/MM/yy";
SimpleDateFormat df = new SimpleDateFormat(myFormatString);
Date givenDate = df.parse("15/02/13");
Long l = givenDate.getTime();
//create date object
Date next = new Date(l);
//compare both dates
if(next.after(current) || (next.equals(current))){
System.out.println("The date is future day");
} else {
System.out.println("The date is older than current day");
}
Run Code Online (Sandbox Code Playgroud)
在这里,当我在15/02/13检查时,它显示为比当前日期更早.我的方法错了吗?还是有更好的方法?
我正在使用Apache CXF Framework,我在cxf-servlet.xml中指定了Restful以及Soap Webservice,在部署项目并通过url请求服务列表为htt:// SystemIP:8080/WebServicesExample/services /出现具有SOAP和REST服务的服务列表,有没有办法隐藏列表中列出的REST服务?