Layui table timestamp conversion date format

Today I received a request to let the front end convert the timestamp into a date format on the layui form. Originally it was done in the background, but when the background couldn’t be adjusted, it was replaced by the front desk. Solving the problem is also very simple, just add this line of code
templet: "

{ {layui.util.toDateString(d. Convert date value, 'yyyy-MM-dd HH:mm:ss')}}

The problem is shown in the figure below:
insert image description here

The solution to the problem is as follows:
insert image description here
the code is as follows:

{
    
    
      field: 'createTime',
       title: '创建时间',
       width: 180,
       templet : "<div>{
    
    {
    
    layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"
   },{
    
    
       field: 'lastUpdateTime',
       title: '更新时间',
       width: 180,
       templet : "<div>{
    
    {
    
    layui.util.toDateString(d.lastUpdateTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"
     },

Results as shown below:
insert image description here

Guess you like

Origin blog.csdn.net/li22356/article/details/124863392