当前位置:网站首页>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} `;
});边栏推荐
- What are the advantages and disadvantages of PHP
- Internal control of fund managers
- A new round of popularity of digital collections opens
- 新品大揭秘!雅迪冠能 3 多元产品矩阵,满足全球用户出行需求
- Google's new paper Minerva: solving quantitative reasoning problems with language models
- CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry
- How to get the maximum value of column two and regenerate the table when the SQL Server column one is the same
- . Net 5.0+ does not need to rely on third-party native implementation of scheduled tasks
- Kotlin coprocessor scheduling switch threads it's time to unravel the truth
- LeetCode. One question of the day: offer II 091 Paint the house (DP problem)
猜你喜欢

关于#SQL#的问题,如何解决?

Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB

How does MySQL copy table data from one database to another (two databases are not linked to the same database)
![[matytype] insert MathType inter line and intra line formulas in CSDN blog](/img/ff/871a3f06f898ed107a2a974d2c7bc4.png)
[matytype] insert MathType inter line and intra line formulas in CSDN blog
![[.net6] use ml.net+onnx pre training model to liven the classic](/img/b3/b117481fba7257453011e4cdb1eaaa.png)
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B

CVPR 2022 | 基于密度与深度分解的自增强非成对图像去雾

Half of 2022 has passed, isn't it sudden?

基于Matlab的开环Buck降压斩波电路Simulink仿真电路模型搭建

Google's new paper Minerva: solving quantitative reasoning problems with language models

JS foundation -- data type
随机推荐
Submission lottery - light application server essay solicitation activity (may) award announcement
Project0:小游戏
“目标检测”+“视觉理解”实现对输入图像的理解及翻译(附源代码)
dotnet 控制台 使用 Microsoft.Maui.Graphics 配合 Skia 进行绘图入门
Ask everyone in the group about the fact that the logminer scheme of flick Oracle CDC has been used to run stably in production
[MPC] ② quadprog solves positive definite, semi positive definite and negative definite quadratic programming
CCNP Part XII BGP (IV)
Neurips 2022 | cell image segmentation competition officially launched!
MIT's latest paper, "the need for interpretable features: motivation and classification": building interpretability in the constituent elements of machine learning models
华为HMS Core携手超图为三维GIS注入新动能
基金管理人的合规管理
毕业季·进击的技术er
Sqlachemy common operations
Matplotlib数据可视化基础
Error: missing revert data in call exception
The first anniversary of the data security law, which four major changes are coming?
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
CVPR 2022 | 基于密度与深度分解的自增强非成对图像去雾
获取键代码
Recommend a JSON visualization tool artifact!