当前位置:网站首页>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')}}
边栏推荐
- “我的”Bug大全(转载)
- JSX compilation
- [elementui El date picker date selector, the end time must not be earlier than the start time, and only the date of the specified number of days from the start time can be selected]
- Day14 view set and route
- es6 map提取数组对象
- [GFCTF 2021]Baby_ Cve-2021-41773 on the web
- promise
- 二分法查找
- C Programming Language(2nd Edition)--读书笔记--1.5.1
- Uni app wechat official account (4) - address management page
猜你喜欢

Page layout - three column layout solution

当 std::bind 遇上 this

How to modify the color of a line of text in the elemtnui table (elemtnui table modifies the color of a line of text)

单页面应用 SPA 和多页面应用 MPA

JSX syntax

js截取字符串前几位或者截取字符串后几位

Uni app wechat official account (5) - add and modify addresses
![Stack injection [strong net cup 2019] random note](/img/94/9069ed79e994e3c2e96c3cd1f816ee.png)
Stack injection [strong net cup 2019] random note

uni-app微信小程序——商城(7)——商品详情

Common mode attack and shared prime of RSA
随机推荐
Record once easy_ SQL Stack Injection
JS高阶函数 filter/map/reduce
Vue项目部署,清理缓存
使用redis - zset做排行榜
PCRE bypasses regular
网站如何统计访问人数?51LA如何安装使用?
Uni app wechat applet - Mall (4) - merchants
今天的码农女孩做了关于生命周期的笔记以及动态时钟的练习
STM32F10x--C语言-1
JSX compilation
深拷贝与浅拷贝
uni-app微信小程序——商城(6)——我的主页
单页面应用 SPA 和多页面应用 MPA
(五)printf(代替echo)
Use leaflet to copy the original shentiwa Mega map to make a diary
js字符串转对象 js对象转字符串 js字符串与对象互转
MoveIt2——2.MoveIt在RViz中的快速入门
three.js初体验:模拟一个小树杈的生长
uni-app微信公众号(4)——地址管理页面
【ElenmentUI el-date-picker日期选择器,结束时间不得早于开始时间,且只能选择距开始时间指定天数的日期】