小编Pra*_*sav的帖子

要检查日期是否在指定日期之后?

我正在尝试对日期进行验证,该日期应仅采用当前和未来日期,如果日期是旧日期则应显示

日期早于当天

我也想允许当前日期.现在正在给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检查时,它显示为比当前日期更早.我的方法错了吗?还是有更好的方法?

java date

5
推荐指数
3
解决办法
3万
查看次数

从Webservice列表中隐藏Restful服务(Apache CXF)

我正在使用Apache CXF Framework,我在cxf-servlet.xml中指定了Restful以及Soap Webservice,在部署项目并通过url请求服务列表为htt:// SystemIP:8080/WebServicesExample/services /出现具有SOAP和REST服务的服务列表,有没有办法隐藏列表中列出的REST服务?

java soap wsdl web-services cxf

1
推荐指数
1
解决办法
3020
查看次数

标签 统计

java ×2

cxf ×1

date ×1

soap ×1

web-services ×1

wsdl ×1