字符串时间转换并比较大小

比较前端发来的时间字符串大小

 SimpleDateFormat timeFormat=new SimpleDateFormat("yyyy-MM-dd");
        String casestart = goverAffair.getCasestart();
        String caseend = goverAffair.getCaseend();
        try {
    
    
            Date start = timeFormat.parse(casestart);
            Date end = timeFormat.parse(caseend);
            if (start.after(end)){
    
    
            	//业务代码,立案时间不得大于结案时间
                timeJudge = true;
            }
        } catch (ParseException e) {
    
    
            e.printStackTrace();
        }

格式化数据库查询的时间返回给前端

  String time = new SimpleDateFormat(" yyyy-MM-dd ").format(db.get("talk_date"));

猜你喜欢

转载自blog.csdn.net/weixin_45010894/article/details/110387518