当前位置:网站首页>Moment.js中format方法函数的格式
Moment.js中format方法函数的格式
2022-04-23 06:24:00 【资深咸鱼~】
moment().format(参数) 返回参数设定的当前日期格式
例:参数为‘YYYY-MM-DD HH:mm:ss’
详细请见下图:
格式代码 | 说明 | 返回值 |
M | 数字表示的月份,没有前导零 | 1-12 |
MM | 数字表示的月份,有前导零 | 01-12 |
MMM | 三个字母缩写表示的月份 | Jan-Dec |
MMMM | 月份,完整的文本格式 | January-December |
Q | 季度 | 1-4 |
D | 月份中的第几天,没有前导零 | 1-31 |
DD | 月份中的第几天,有前导零 | 01-31 |
d | 星期中的第几天,数字表示 | 0-6,0为周日,1-6为星期一到星期六 |
ddd | 三个字母表示星期中的第几天 | Sun-Sat |
dddd | 星期几,完整的文本方式 | 从Sunday-Saturday |
w | 年份中的第几周 | 如27:表示第27周 |
YYYY | 四位数字表示的完整年份 | 如:2021 |
YY | 两位数字表示年份 | 如:21 |
A | 大写的AM PM | AM PM |
a | 小写的am pm | am pm |
HH | 小时,24小时制,有前导零 | 00-23 |
H | 小时,24小时制,没有前导零 | 0-23 |
hh | 小时,12小时制,有前导零 |
00-12 |
h | 小时,12小时制,没有前导零 | 0-12 |
m | 分钟,没有前导零 | 0-59 |
mm | 分钟,有前导零 | 00-59 |
s | 秒数,没有前导零 | 1-59 |
ss | 秒数,有前导零 | 01-59 |
X | Unix时间戳 | 1298372741 |
版权声明
本文为[资深咸鱼~]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_51644702/article/details/123981926
边栏推荐
- 如何SQL 语句UNION实现当一个表中的一列内容为空时则取另一个表的另一列
- Take you to travel in space, and American photography technology provides comprehensive technical support for aerospace creative applet
- Urban emergency management - urban emergency communication command and dispatching system
- 数论之阶与原根讲解
- Intelligent communication solution of Hainan Phoenix Airport
- HuggingFace
- Emergency communication system for flood control and disaster relief
- 保洁阿姨都能看懂的中国剩余定理和扩展中国剩余定理
- Mysql持久性的实现
- [2020WC Day2]F.采蘑菇的克拉莉丝(子树和查询、轻重儿子思想)
猜你喜欢
Mysql持久性的实现
通过sparksql读取presto中的数据存到clickhouse
Mysql 数据库从设计上的优化
可视化之路(十二)Collection类详解
quill-editor图片缩放、在一个页面使用多个富文本框、quill-editor上传图片地址为服务器地址
Discussion on frame construction and technology selection of short video platform
Jiangning hospital DMR system solution
# 可视化常见绘图(二)折线图
H5 case development
Lead the industry trend with intelligent production! American camera intelligent video production platform unveiled at 2021 world Ultra HD Video Industry Development Conference
随机推荐
PyTorch 12. Hook usage
LATEX使用
技能点挖坑
LATEX公式注意事项
VIM使用
Patrol inspection intercom communication system in power industry
数据分析学习(一)数据分析和Numpy基础
anaconda3安装
可视化常见问题解决方案(九)背景颜色问题
学习资料
[ACM-ICPC 2018 沈阳赛区网络预赛] J.Ka Chang (分块+dfs序)
Background management system framework, there is always what you want
使用compressorjs压缩图片,优化功能,压缩所有格式的图片
可视化常见绘图(一)堆叠图
Jupyter Notebook 安装
The people of Beifeng have been taking action
Machine vision series (02) -- tensorflow2 3 + win10 + GPU installation
[LNOI2014]LCA——树链剖分——多点LCA深度和问题
数论之阶与原根讲解
如何将进程绑定到指定的CPU上