zoukankan      html  css  js  c++  java
  • 解决layui数据表格Date日期格式的回显Object的问题

    有属性: private Date createtime;

    但是回显的时候,显示{ Object object },想要转换成字符串格式显示。

    怎么解决?

    首先:数据库中时间的定义:

       datetime和timestamp有什么区别?

    (一)范围不同。
    “datetime” 以'YYYY-MM-DD HH:MM:SS'格式检索和显示DATETIME值。支持的范围为'1000-01-01 00:00:00'到'9999-12-31 23:59:59'TIMESTAMP值不能早于1970或晚于2037
    (二)储存不同。
    1,TIMESTAMP
    ①4个字节储存(Time stamp value is stored in 4 bytes)
    ②值以UTC格式保存( it stores the number of milliseconds)
    ③时区转化 ,存储时对当前的时区进行转换,检索时再转换回当前的时区。
    2,datetime
    ①8个字节储存(8 bytes storage)
    ②实际格式储存(Just stores what you have stored and retrieves the same thing which you have stored.)
    ③与时区无关(It has nothing to deal with the TIMEZONE and Conversion.)

    其实使用也是一样的,它会根据数据库自动更新时间
    所以,我们在使用的时候,直接

    有属性: private String createtime;
    前端就可以不用去转换格式了

     

     https://blog.csdn.net/J080624/article/details/53419408?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight



  • 相关阅读:
    centos 6 安装
    DNS介绍
    Saltstack远程执行(四)
    Saltstack数据系统Grains和Pillar(三)
    array_multisort 二维数组排序
    jqgit...
    Redis 创建多个端口 链接redis端口
    百度商桥回话接口
    加ico
    redis 新开端口号
  • 原文地址:https://www.cnblogs.com/yangmie/p/13086780.html
Copyright © 2011-2022 走看看