Jq, get rid of the last ten

the following is a circular list of data requested by ajax. The print of"+ data [I] .createTime +"in li is 2019-02-26 15:15:51. How to remove the following 15:15:51 minutes

    for(var i=0;i<6;iPP){
        var tbBody = "";
        tbBody += "<li>"+data[i].createTime+"</li>"        
    }
Jul.14,2022

The problem of

seemingly not using jq
is actually a string interception problem: how to turn 2019-02-26 15:15:51 into 2019-02-26
there are really too many methods.

clipboard.png

const str = '2019-02-26 15:15:51'
console.log(str.split(' ')[0])
console.log(str.substring(0, 10))
console.log(str.match(/\d{4}-\d{2}-\d{2}/)[0])

if it helps you, please upvote or adopt ~


data [I] .createTime.slice (0Magne10)

Menu