specificDate.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:open-Autoscaler 作者:
@AssertTrue(message="{specificDate.isDateTimeValid.AssertTrue}")
private boolean isDateTimeValid() {
    try {
        SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        dateformat.setLenient(false);
        ParsePosition position = new ParsePosition(0);
        String firstDateTime = this.startDate + " " + this.startTime;
        String secondDateTime = this.endDate + " " + this.endTime;
        Date first = dateformat.parse(firstDateTime, position);
        if (( first == null) || (position.getIndex() != firstDateTime.length()))
            return false;
        position = new ParsePosition(0);
        Date second = dateformat.parse(secondDateTime, position);
        if (( second == null) || (position.getIndex() != secondDateTime.length()))
            return false;
        return first.before(second);
    } catch (Exception e) {
        BeanValidation.logger.info(e.getMessage());
        return false;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号