码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-02-17 10:56:59      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

将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月工作记录

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

标签:

原文地址:http://www.cnblogs.com/zhengteng/p/5194509.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!