当前位置:网站首页>Timestamp conversion time
Timestamp conversion time
2022-07-19 01:34:00 【Think of a name for a long time】
main.js Timestamp conversion time
Vue.filter('formatDate', function (value, fdata) {
let getDate = new Date(value)
let a = {
'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(),
'h+': getDate.getHours(),
'm+': getDate.getMinutes(),
's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3),
'S': getDate.getMilliseconds()
}
if (/(y+)/.test(fdata)) {
fdata = fdata.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let b in a) {
if (new RegExp('(' + b + ')').test(fdata)) {
fdata = fdata.replace(RegExp.$1, (RegExp.$1.length === 1) ? (a[b]) : (('00' + a[b]).substr(('' + a[b]).length)))
}
}
return fdata
})
Usage method :
{
{
Date | formatDate('yyyy-MM-dd')}} {
{
Date | formatDate('yyyy-MM-dd hh:mm:ss')}}
边栏推荐
- NodeJS 跨域 CORS
- 今天的码农女孩学习了关于nodejs和REPL 交互式解释器的知识
- uni-app微信小程序——商城(7)——商品详情
- Assemblage stylisé de cartes de commutation auto - encapsulées
- Day15 paging, filtering
- extern和static的区别
- Day14 view set and route
- Day16 sorting, current limiting
- The C Programming Language (2nd)--笔记--1.8
- Record once easy_ SQL Stack Injection
猜你喜欢

uni-app微信小程序——商城(6)——我的主页

Self encapsulated stylized switch card assembly

Record once easy_ SQL Stack Injection

分布式之数据库和缓存双写一致性方案解析(转载)

Initial flask

使用redis - zset做排行榜

wget 警告: 无法验证

Assemblage stylisé de cartes de commutation auto - encapsulées

XSS simple summary

Uni app wechat applet - Mall (6) - my home page
随机推荐
uni 阻止按钮多次点击 按钮多次点击
Moveit2——1.开始
From catf1ag two-hour AK match pwn/attack killing, summarize the common command guide of emergency response
v-model原理及修饰符
Record once easy_ SQL Stack Injection
NodeJS 跨域 CORS
qs模块是?
(九)Shell 输入输出重定向
TCP与UDP,TCP服务器与客户端,UDP服务器与客户端
小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId
router和keep-alive
JSX 语法
MoveIt2——2.MoveIt在RViz中的快速入门
(六)test命令
深拷贝与浅拷贝
JS string to object JS object to string JS string to object
Express中间件的分类及使用
今天的码农女孩学习了关于事件操作和ref属性的笔记并做了表单双向绑定的练习
MoveIt2——4.机器人模型和机器人状态
Initial flask