For example, convert 2020-12-09T09:06:46.086Z to: 2020-12-09 17:06:46
Here directly use the plug-in: dayjs to achieve
One, download dayjs
cnpm i -S dayjs
Two, introduce dayjs
If it is in node, the introduction method is: var dayjs=require('dayjs')
If in the vue project, the introduction method is:
import dayjs from "dayjs"
Vue.prototype.dayjs = dayjs;
Three, use
console.log("转换前",new Date())
console.log("转换后",dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"))
Fourth, the effect
If it is not too troublesome, you can also convert by yourself, please refer to: https://blog.csdn.net/qq_40323256/article/details/102867033