substring() 方法用于提取字符串中介于两个指定下标之间的字符
var date = '2020-01-01 00:00:00' date.substring(0 ,10) console.log(date) // 2020-01-01