当前位置:网站首页>Node's traditional and advanced practices for formatting time (moment)
Node's traditional and advanced practices for formatting time (moment)
2022-08-01 09:24:00 【quite a bit】
Traditional way of formatting time
Zero paddingMethod: 
The method that takes time (except year,Others need to be filled with zeros): 
Expose dateFormat method
Import a custom formatted time module and use
>
Result: 
dt gets the current time, and then converts dt through the dateDormat method in the introduced TIME
Advanced practice of formatting:
Do not encapsulate it yourself, use a third-party package
command to install package in project
View how to use moment
npmjs website search moment
Click in
You can see the package on the rightcommand required when
The version number of the package, the weekly download amount Weekly Download
Note: To see how to use moment, click Documentation on the left (or right click to open the link in a new tab)

Pull down to view the parameters that can be passed in:

etc.
Note: Hh mm will be filled with zeros when they represent reality.
Use and results:
边栏推荐
- 用OpenCV的边缘检测
- How to get page data
- Redis学习
- 【Unity3D】相机
- pytest interface automation testing framework | single/multiple parameters
- [Dataset] Dataset summary of various insulators, bird's nests and anti-vibration hammers
- Prime Ring Problem
- Gethostbyname \ getaddrinfo DNS domain name IP address is not safe
- 常见的API安全缺陷有哪些?
- codeforces每日5题(均1600)-第二十七天
猜你喜欢

C语言中编译时出现警告C4013(C语言不加函数原型产生的潜在错误)

22 Grab the Seat 1 C.Grab the Seat (Geometry + Violence)

Holoview--Introduction

js中如何实现深拷贝?

如何保证数据库与缓存数据一致性?

ACmix 论文精读,并解析其模型结构

JVM内存模型之深究模型特征

The soul asks: How does MySQL solve phantom reads?

leetcode-6132:使数组中所有元素都等于零
Get the Token from the revised version of Qubutu Bed
随机推荐
leetcode-6132:使数组中所有元素都等于零
A problem with writing to the database after PHP gets the timestamp
leetcode 42. Catch the rain
微服务:事务管理
[Interview: Concurrency 39: Multithreading: Thread Pool] ThreadPoolExecutor Class - Submit, Stop
指针的介绍及应用
【杭电多校第四场 B题】最短路图+缩点dp
CTO强烈禁止使用Calendar,那用啥?
基于tika实现对文件类型进行判断
sqlserver 对比两张表的差异
扁平数组转树结构实现方式
USB Protocol (2) Terminology
SaaS安全认证综合指南
【编程之外】当遮羞布被掀开,当人们开始接受一切
TiDB的真实数据库数据是存在kv和还是pd上?
走进音视频的世界——mp3封装格式
Is the real database data of TiDB stored in kv and pd?
Shell executes SQL to send emails
What do the values 1, 2, and 3 in nodetype mean?
Microsoft Azure & NVIDIA IoT 开发者季 I|Azure IoT & NVIDIA Jetson 开发基础