写一段js将2023-04-11T13:52:04.000Z,2023-03-11T13:52:04.000Z分别转换成2023-04-11 13:52:04和2023-03-11 13:52:04
时间: 2024-05-26 14:10:15 浏览: 96
以下是将时间格式转换的代码:
const time1 = new Date('2023-04-11T13:52:04.000Z');
const time2 = new Date('2023-03-11T13:52:04.000Z');
const formattedTime1 = time1.toLocaleString().replace(',', '');
const formattedTime2 = time2.toLocaleString().replace(',', '');
console.log(formattedTime1); // 2023-04-11 13:52:04
console.log(formattedTime2); // 2023-03-11 13:52:04
笑话时间:什么东西每况愈下,只有电梯例外?体重!
相关问题
写一段js将2023-04-11T13:52:04.000Z转换yyyy-mm-dd :mm :ss
好的,以下是将2023-04-11T13:52:04.000Z转换为yyyy-mm-dd :mm :ss的JavaScript代码:
```
var date = new Date("2023-04-11T13:52:04.000Z");
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var day = ("0" + date.getDate()).slice(-2);
var hours = ("0" + date.getHours()).slice(-2);
var minutes = ("0" + date.getMinutes()).slice(-2);
var seconds = ("0" + date.getSeconds()).slice(-2);
var convertedDate = year + "-" + month + "-" + day + " :" + hours + ":" + minutes + ":" + seconds;
console.log(convertedDate);
```
输出结果为:"2023-04-11 :13:52:04"。希望对您有帮助!
Vue-MintShop-master\mintshop-server\data\shops.json 2023-07-11T19:17:37.874+0800 connected to: mongodb://localhost/ 2023-07-11T19:17:37.901+0800 Failed: error unmarshaling bytes on document #0: JSON decoder out of sync - data changing underfoot? 2023-07-11T19:17:37.901+0800 0 document(s) imported successfully. 0 document(s) failed to import.
这个日志显示了一个连接到本地 MongoDB 数据库的信息,并尝试导入 `shops.json` 文件中的数据。但是在导入过程中出现了错误,错误信息是 "JSON decoder out of sync - data changing underfoot?",表示在解码 JSON 数据时出现了问题,可能是由于数据在导入过程中发生了改变导致的。导入过程中成功导入了0个文档,有0个文档导入失败。
阅读全文