当前位置:网站首页>[encapsulation of time format tool functions]
[encapsulation of time format tool functions]
2022-07-07 11:19:00 【Guodong pudding】
timegs.js
export default function formatMsgTime (timespan) {
var dateTime = new Date(timespan) // Convert the incoming string or MS to standard time
var year = dateTime.getFullYear()
var month = dateTime.getMonth() + 1
var day = dateTime.getDate()
var hour = dateTime.getHours()
var minute = dateTime.getMinutes()
// var second = dateTime.getSeconds()
var millisecond = dateTime.getTime() // Converts the time of the current edit to milliseconds
var now = new Date() // Get the current time of the machine
var nowNew = now.getTime() // Convert local time to milliseconds
var milliseconds = 0
var timeSpanStr
milliseconds = nowNew - millisecond
if (milliseconds <= 1000 * 60 * 1) { // Less than a minute for just
timeSpanStr = ' just '
} else if (1000 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60) { // More than one minute and less than one hour are displayed as 边栏推荐
猜你喜欢
随机推荐
[untitled]
Add a self incrementing sequence number to the antd table component
Socket socket programming
The eighth training assignment
关于测试人生的一站式发展建议
Kitex 重试机制
vim 的各种用法,很实用哦,都是本人是在工作中学习和总结的
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
Case study of Jinshan API translation function based on retrofit framework
After the uniapp jumps to the page in onlaunch, click the event failure solution
verilog设计抢答器【附源码】
Unsupervised learning of visual features by contracting cluster assignments
[untitled]
The opacity value becomes 1%
使用MeterSphere让你的测试工作持续高效
Hash / (understanding, implementation and application)
Qtcreator sets multiple qmake
2021-04-08
滚动踩坑--UNI_APP(八)
uniapp 在onLaunch中跳转页面后,点击事件失效解决方法

![[untitled]](/img/c7/b6abe0e13e669278aea0113ca694e0.jpg)


![Verilog realizes nixie tube display driver [with source code]](/img/ad/be94912bedc738f4b5f97138db7352.png)



