当前位置:网站首页>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} `;
});边栏推荐
- 建议收藏 | 在openGauss上遇到慢SQL该怎么办?
- 技术分享 | Linkis参数介绍
- Crawler (2) - requests (1) | deep parsing of requests module
- LeetCode 438. 找到字符串中所有字母异位词__滑动窗口
- Uncover the secrets of new products! Yadi Guanneng 3 multi product matrix to meet the travel needs of global users
- Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
- JS foundation -- data type
- Matplotlib data visualization Foundation
- [.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
- 【MPC】①二次规划问题MATLAB求解器quadprog
猜你喜欢

Matplotlib数据可视化基础

Wireshark TS | confusion between fast retransmission and out of sequence

【MPC】①二次规划问题MATLAB求解器quadprog

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

What are the advantages and disadvantages of PHP

Google's new paper Minerva: solving quantitative reasoning problems with language models
![[MPC] ① quadratic programming problem matlab solver quadprog](/img/be/5e300255041e3348b933bc32e2ea46.png)
[MPC] ① quadratic programming problem matlab solver quadprog

建议收藏 | 在openGauss上遇到慢SQL该怎么办?

How does MySQL copy table data from one database to another (two databases are not linked to the same database)

The project bar on the left side of CodeBlocks disappears, workspace automatically saves the project, default workspace, open the last workspace, workspace (Graphic tutorial, solved)
随机推荐
十年磨一剑:蚂蚁集团可观测性平台 AntMonitor 揭秘
SQL optimization - in and not in, exist
NC | 肠道细胞和乳酸菌共同作用来防止念珠菌感染
CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry
How to solve the problem of SQL?
Handling distributed transactions with powerful dbpack (PHP tutorial)
移动硬盘驱动器读到,但不显示盘符
LeetCode 438. Find all letter ectopic words in the string__ sliding window
爬虫(2) - Requests(1) | Requests模块的深度解析
Detailed explanation of linear regression in machine learning
华为HMS Core携手超图为三维GIS注入新动能
Database experiment report (II)
Want to open an account, is it safe to open an account of Huatai Securities online?
Sqlachemy common operations
Error: missing revert data in call exception
[paper reading] trajectory guided control prediction for end to end autonomous driving: a simple yet strong Ba
Design and practice of new generation cloud native database
Website source code whole site download website template source code download
想请教一下,我在广州,到哪里开户比较好?现在网上开户安全么?
What are the advantages and disadvantages of PHP