当前位置:网站首页>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} `;
});边栏推荐
- Compliance management of fund managers
- applyMiddleware 原理
- How to solve the problem of SQL?
- LeetCode 438. Find all letter ectopic words in the string__ sliding window
- [.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
- . Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
- Want to open an account, is it safe to open an account of Huatai Securities online?
- Venv: directory structure of venv
- 12. Gateway new generation gateway
- Ten years of sharpening a sword: unveiling the secrets of ant group's observability platform antmonitor
猜你喜欢

CRC 校驗

LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer

The list of winners of the digital collection of "century master" was announced

LeetCode.515. 在每个树行中找最大值___逐一BFS+DFS+按层BFS

Combinaison Oracle et json

Combination of Oracle and JSON

Mall applet source code open source version - two open

网站源码整站下载 网站模板源代码下载

A new round of popularity of digital collections opens

12 product management platforms that everyone is using
随机推荐
Have the bosses ever done the operation of sink shunting and writing to Clickhouse or other databases.
Oracle和JSON的结合
中国探月工程独家藏品限量发售!
Matplotlib data visualization Foundation
“目标检测”+“视觉理解”实现对输入图像的理解及翻译(附源代码)
[.NET6]使用ML.NET+ONNX预训练模型整活B站经典《华强买瓜》
Database experiment report (II)
Lack of comparator, operational amplifier to save the field! (the op amp is recorded as a comparator circuit)
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
CRC 校验
Mutual conversion of pictures in fluent uint8list format and pictures in file format
新一代云原生数据库的设计与实践
[paper reading] trajectory guided control prediction for end to end autonomous driving: a simple yet strong Ba
flutter Uint8List格式的图片和File格式图片的互相转换
The first anniversary of the data security law, which four major changes are coming?
Yoda unified data application -- Exploration and practice of fusion computing in ant risk scenarios
2022年现在在网上开通股票账户安全吗?会不会有什么危险?
Rising stars in Plant Sciences (rsps2022) final Science Lecture (6.30 pm)
106. 从中序与后序遍历序列构造二叉树
数据库的增删改查问题