代码如下所示:先转成date就行了 // 获取某个时间格式的时间戳 var stringTime = "1990-01-01 "; var timestamp = Date.parse(new Date(stringTime)); timestamp = timestamp / 1000; //1990-01-01 时间戳 console.log(stringTime + "的时间戳为:" + timestamp);