当前位置:网站首页>About the time format and the method of getting the specified time
About the time format and the method of getting the specified time
2022-08-06 00:32:00 【Swn_】
Using the moment.js script
Official website address: moment.js
Date formatting
moment().format('MMMM Do YYYY, h:mm:ss a'); // Jun 24 2020, 4:57:17 PMmoment().format('dddd'); // Wednesdaymoment().format("MMM Do YY"); // June 24th 20moment().format('YYYY [escaped] YYYY'); // 2020 escaped 2020moment().format(); // 2020-06-24T16:57:17+08:00Relative time
moment("20111031", "YYYYMMDD").fromNow(); // 9 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 8 years ago
moment().startOf('day').fromNow(); // 17 hours ago
moment().endOf('day').fromNow(); // within 7 hours
moment().startOf('hour').fromNow(); // 1 hour ago
Calendar Time
moment().subtract(10, 'days').calendar(); // 2020/06/14moment().subtract(6, 'days').calendar(); // last Thursday at 16:57moment().subtract(3, 'days').calendar(); // last Sunday at 16:57moment().subtract(1, 'days').calendar(); // 16:57 yesterdaymoment().calendar(); // today at 16:57moment().add(1, 'days').calendar(); // tomorrow at 16:57moment().add(3, 'days').calendar(); // next Saturday at 16:57moment().add(10, 'days').calendar(); // 2020/07/04Multilingual support
moment.locale(); // en-usmoment().format('LT'); // 16:57moment().format('LTS'); // 16:57:17moment().format('L'); // 2020/06/24moment().format('l'); // 2020/6/24moment().format('LL'); // June 24, 2020moment().format('ll'); // June 24, 2020moment().format('LLL'); // June 24, 2020 4:57 PMmoment().format('lll'); // 24 Jun 2020 16:57moment().format('LLLL'); // Wed Jun 24, 2020 4:57 PMmoment().format('llll'); // Wed Jun 24 2020 16:57边栏推荐
猜你喜欢

kappa系数---学习笔记

湖仓一体电商项目(六):大屏可视化工具腾讯云图
Taught you how to locate online MySQL lock timeout problem, BaoJiao package

白话机器学习-卷积神经网络CNN

MySQL: The Basics of Indexing

Qt入门(零)——Qt概述

2022-08-05 The sixth group Hide spring study notes

Solve the problems arising from the mysql statement MAX () function

隐私计算基础组件系列-混淆电路

【u-boot】如何自定义u-boot的命令
随机推荐
Pycharm 专业版与社区版的区别
解决mysql语句MAX()函数中出现的问题
如何对齐微信小程序胶囊按钮?
【电商运营】网上商店如何利用好自己的营销数据达成目标?
子页面监听父页面点击事件
为啥强烈禁止使用Calendar?
顺序表的快慢指针应用:leetcode26、27、88、大数加法989(交换数组)
【PMP学习笔记】第4章 项目整合管理
解决删除凭据管理器后仍然可以访问问题
横向联邦学习-梯度安全聚合1
Windows iis环境下创建织梦php网站图文教程
我明明加了唯一索引,数据库怎么还是产生重复数据?
区间DP
Jenkins 配置邮件
网页使用微信扫码登录
leetcode 240. Search a 2D Matrix II 搜索二维矩阵 II(中等)
【论文阅读】Virtual Adversarial Training: a Regularization Method for SL and SSL
Code Casual Recording Notes_Dynamic Programming_494 Objectives and
[2022 强网杯] house_of_cat 战战兢兢的复现
数据库应用系统中有什么核心问题