zoukankan      html  css  js  c++  java
  • fastTime从后台传过来显示格式的处理

    1、可以在控制台用syso查看

    QuestionFeedbackView qfv = on_LineManageService.getBringupHead(projectNo);//qfv是一个内含两个 时间属性 的对象
    // 输出格式: 2015-1-27 或 Jan 27, 2015
    Date begin = qfv.getActualbegin();
    Date end = qfv.getActualend();
    String actualBegin = DateFormat.getDateInstance(DateFormat.MEDIUM).format(begin);//以字符串的形式输出  输出格式: 2015-1-27
    String actualEnd = DateFormat.getDateInstance(DateFormat.MEDIUM).format(end);

    2、通过ajax回显到页面

    success : function(result) {//result.data为上述qfv
    if (result.isSuccess) {
    var begin = new Date(parseInt(result.data.actualbegin));
    var end = new Date(parseInt(result.data.actualend));
    $("#clientmag").text(result.data.clientManager);
    $("#productmag").text(result.data.productManager);

    //$("#begintime").text(result.data.actualbegin.format("yyyy-MM-dd"));//页面显示会报错

    //$("#begintime").text(result.data.actualbegin);//页面显示为一串数字,即fastTime
    $("#begintime").text(begin.format("yyyy-MM-dd"));//页面显示为: 2015-1-27格式
    $("#endtime").text(end.format("yyyy-MM-dd"));
    }
    },

    上述为两种从后台传到前端的日期格式处理,后续碰到从前端传到后端存储的再加

  • 相关阅读:
    晕晕的一天
    23. 合并K个排序链表
    25. K 个一组翻转链表
    328. 奇偶链表
    86. 分隔链表
    290. 单词规律
    202. 快乐数
    242. 有效的字母异位词
    16.最接近的三数之和
    (转) java 简单工厂模式(实现一个计算器)
  • 原文地址:https://www.cnblogs.com/zz-3m23d-begining/p/6747908.html
Copyright © 2011-2022 走看看