当前位置:网站首页>[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
边栏推荐
- Network foundation (1)
- Add a self incrementing sequence number to the antd table component
- seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)
- POJ1821 Fence 题解报告
- PostgreSQL中的表复制
- Leetcode - interview question 17.24 maximum submatrix
- JSON format query of MySQL
- Interprocess communication (IPC)
- Eth trunk link switching delay is too high
- Socket socket programming
猜你喜欢
About the application of writing shell script JSON in JMeter
verilog设计抢答器【附源码】
MPX plug-in
90后,辞职创业,说要卷死云数据库
Wallhaven wallpaper desktop version
The opacity value becomes 1%
[C #] the solution of WinForm operation zoom (blur)
2021-05-21
Seata 1.3.0 four modes to solve distributed transactions (at, TCC, Saga, XA)
Wallhaven壁纸桌面版
随机推荐
关于SIoU《SIoU Loss: More Powerful Learning for Bounding Box Regression Zhora Gevorgyan 》的一些看法及代码实现
Activity lifecycle
【愚公系列】2022年7月 Go教学课程 005-变量
科普达人丨一文弄懂什么是云计算?
常用sql语句整理:mysql
There are ways to improve self-discipline and self-control
【问道】编译原理
How to use cherry pick?
Process control (creation, termination, waiting, program replacement)
自律,提升自制力原来也有方法
Kitex retry mechanism
Go Slice 比较
electron添加SQLite数据库
Avoid mutating a prop directly since the value will be overwritten whenever the parent component
oracle常见锁表处理方式
[untitled]
Go-Redis 中间件
The post-90s resigned and started a business, saying they would kill cloud database
学习笔记|数据小白使用DataEase制作数据大屏
Kitex 重试机制