将Date格式日期在前端页面显示


将Date格式日期在前端页面显示需要在代码中转换为String形式

List<IndustryBean> list=industryService.getByletterOrDateList(industryBean);
        for (int i = 0; i < list.size(); i++) {
            Date date = list.get(i).getCreateDate();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String rightDate = sdf.format(date);
            list.get(i).setRightDate(rightDate);
        }
        return JSONObject.toJSONString(list);

 String.ForMat 将对象的值转为基于指定格式的字符串 并将其插入到指定字符串

例String title = String.format("%s-%s月工作记录",userBean.getName(),mouth); xx-01月工作记录


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM