首页 > 其他 > 详细

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

时间:2016-02-17 10:55:35      阅读:856      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!