当前位置:网站首页>Global filter (processing time format)
Global filter (processing time format)
2022-07-01 10:56:00 【Yuzhibo Linzhong Road】
padStart() For head completion
padStart(2,'0') Convert to string '3', Less than two , Add a front 0, Output is 03, The date of complete settlement is as :2020-07-06 This kind of problem
//padStart(2,'0') Convert to string '6', Less than two , Add a front 0, Output is 06, The date of complete settlement is as :2020-07-06 This kind of problem
var month = 6;
var newMonth = (month + "").padStart(2, "0");
console.log(newMonth); //06
//padStart(3,'0') Convert to string '7', Less than three , Add a front 00, Output is 007
var day = 7;
var newDay = day.toString().padStart(3, "0");
console.log(newDay); //007padEnd() For tail completion
//padEnd(2,'0') Convert to string '6', Less than two , Add a 0, Output is 60, Not much use
var month = 6;
var newMonth = (month + "").padEnd(2, "0");
console.log(newMonth); //60
//padEnd(3,'0') Convert to string '7', Less than three , Add a 00, Output is 700, Not much use
var day = 7;
var newDay = day.toString().padEnd(3, "0");
console.log(newDay); //700 Global filter method 1:
// main.js In file
// Global filter (' The name of the filter ', Time data processed )
Vue.filter("dataFormat", (data) => {
const dt = new Date(data);
// month +1 Convert to string to process data
const y = dt.getFullYear();
const m = (dt.getMonth() + 1).toString().padStart(2, "0");
const d = dt.getDate().toString().padStart(2, "0");
const hh = dt.getHours().toString().padStart(2, "0");
const mm = dt.getMinutes.toString().padStart(2, "0");
const ss = dt.getSeconds.toString().padStart(2, "0");
return `${y}-${m}-${d} ${hh}:${mm}:${ss} `;
});边栏推荐
- mysql如何把 一个数据库中的表数据 复制到 另一个数据库中(两个数据库不在同一个数据库链接下)
- 2022年现在在网上开通股票账户安全吗?会不会有什么危险?
- Can MySQL CDC take out the op field
- Mobile hard drive reads but does not display drive letter
- . Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
- 内存泄漏定位工具之 valgrind 使用
- 十年磨一剑:蚂蚁集团可观测性平台 AntMonitor 揭秘
- NeurIPS 2022 | 细胞图像分割竞赛正式启动!
- Prism journal navigation button usability exploration record
- 12 plateformes de gestion de produits utilisées par tout le monde
猜你喜欢

.NET 5.0+ 无需依赖第三方 原生实现定时任务

数字藏品平台搭建需要注意哪些法律风险及资质?

Matplotlib数据可视化基础

NeurIPS 2022 | 细胞图像分割竞赛正式启动!

Oracle和JSON的结合

价值1000毕业设计校园信息发布平台网站源码

A new round of popularity of digital collections opens

SQLAchemy 常用操作

Detailed explanation of linear regression in machine learning

Error: missing revert data in call exception
随机推荐
prism journal导航按钮的可用性探索记录
《数据安全法》出台一周年,看哪四大变化来袭?
Handling distributed transactions with powerful dbpack (PHP tutorial)
CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry
Submission lottery - light application server essay solicitation activity (may) award announcement
Ten years of sharpening a sword: unveiling the secrets of ant group's observability platform antmonitor
[encounter Django] - (II) database configuration
【MPC】②quadprog求解正定、半正定、负定二次规划
LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer
Handling distributed transactions with powerful dbpack (PHP tutorial)
Guys, how to export iceberg data to MySQL? What tools are there? Neither sqoop nor dataX
Have the bosses ever done the operation of sink shunting and writing to Clickhouse or other databases.
NC | 肠道细胞和乳酸菌共同作用来防止念珠菌感染
CCNP Part XII BGP (IV)
YoDA统一数据应用——融合计算在蚂蚁风险场景下的探索与实践
I'd like to know where I can open an account in Guangzhou? Is it safe to open an account online now?
Win平台下influxDB导出、导入
Suggest collecting | what to do when encountering slow SQL on opengauss?
毕业季·进击的技术er
Combinaison Oracle et json