当前位置:网站首页>Outil de formatage du temps - mode. JS (affichage en temps réel du temps Web)
Outil de formatage du temps - mode. JS (affichage en temps réel du temps Web)
2022-06-13 06:35:00 【élégance contre le vent】
moment.jsSite officiel:Moment.js Chinese web
Un. 、 Mode d'installation(Fréquent)
yarn add moment
npm i moment --save
2. 、 Utiliser
Format de la date:
moment().format('MMMM Do YYYY, h:mm:ss a'); // Mai 28Jour 2022, 2:54:47 Après - midi
moment().format('dddd'); // Samedi
moment().format("MMM Do YY"); // 5Mois 28Jour 22
moment().format('YYYY [à] YYYY'); // 2022 à2022
moment().format(); // 2022-05-28T14:54:47+08:00Temps relatif:
moment("20111031", "YYYYMMDD").fromNow(); // 11 Il y a un an
moment("20120620", "YYYYMMDD").fromNow(); // 10 Il y a un an
moment().startOf('day').fromNow(); // 15 Il y a une heure
moment().endOf('day').fromNow(); // 9 Dans l'heure
moment().startOf('hour').fromNow(); // 1 Il y a une heureCalendrier:
moment().subtract(10, 'days').calendar(); // 2022/05/18
moment().subtract(6, 'days').calendar(); // Dimanche dernier 14:54
moment().subtract(3, 'days').calendar(); // Mercredi dernier 14:54
moment().subtract(1, 'days').calendar(); // Hier.14:54
moment().calendar(); // Aujourd'hui14:54
moment().add(1, 'days').calendar(); // Demain14:54
moment().add(3, 'days').calendar(); // Mardi prochain14:54
moment().add(10, 'days').calendar(); // 2022/06/07Rendu mm / JJ / AAAA :
moment().format("YYYY-MM-DD") // 2022-05-28 Minutes et secondes de rendu
moment().format("HH:mm:ss") // 15:00RéalisationTemps réel La façon de montrer ( Faites un chronomètre de Gap ,Tous les1Appelé une fois par seconde):
this.nowDate = moment().format("YYYY-MM-DD");
this.nowTime = moment().format("HH:mm:ss");
this.timeF = setInterval(()=>{
this.nowDate = moment().format("YYYY-MM-DD");
this.nowTime = moment().format("HH:mm:ss");
}, 1000);边栏推荐
- Scrcpy source code walk 3 what happened between socket and screen refresh
- 【新手上路常见问答】一步一步理解程序设计
- JetPack - - - LifeCycle、ViewModel、LiveData
- The boys x pubgmobile linkage is coming! Check out the latest game posters
- ADB shell CMD overlay debugging command facilitates viewing system framework character resource values
- 线程相关点
- 347. top k high frequency elements heap sort + bucket sort +map
- IOError(Errors.E050.format(name=name))
- In kotlin?,!,?:,:, - & gt;、== Brief description of symbols
- Wechat applet: click the event to obtain the current device information (basic)
猜你喜欢

【sketchup 2021】草图大师中CAD文件的导入与建模(利用cad图纸在草图大师中建立立面模型)、草图大师导出成品为dwg格式的二维、三维、立面效果到cad中打开预览】

《MATLAB 神经网络43个案例分析》:第11章 连续Hopfield神经网络的优化——旅行商问题优化计算
![[FAQs for novices on the road] about technology management](/img/6f/cb2152d5ddb4714e1b249e50096947.jpg)
[FAQs for novices on the road] about technology management

【sketchup 2021】草图大师的图像输出与渲染之样式说明【边线设置、平面设置、背景设置、水印设置、建模设置、天空背景创建天空、利用水印背景创建天空(重要)】

机器学习笔记 - 监督学习备忘清单

Glide usage notes

c语言对文件相关的处理和应用

SSM framework integration -- > simple background management

Wechat applet custom tabbar (session customer service) vant

Construction and verification of Alibaba cloud server webrtc system
随机推荐
动态链接库嵌套样例
欧姆龙平替国产大货—JY-V640半导体晶元盒读写器
Failed to extract manifest from apk: processexception:%1 is not a valid Win32 Application.
JetPack - - - Navigation
Scrcpy development environment construction and source code reading
ADB shell CMD overlay debugging command facilitates viewing system framework character resource values
Ijkplayer compilation process record
MFS详解(六)——MFS Chunk Server服务器安装与配置
[2022 college entrance examination season] what I want to say as a passer-by
Cross process two-way communication using messenger
Super model logo online design and production tool
Basic knowledge of knowledge map
Analysis of 43 cases of MATLAB neural network: Chapter 11 optimization of continuous Hopfield Neural Network -- optimization calculation of traveling salesman problem
[solution] camunda deployment process should point to a running platform rest API
Construction and verification of Alibaba cloud server webrtc system
Using the shutter floor database framework
Detailed explanation of the player startup process of ijkplayer code walk through
PHP redis makes high burst spike
Detailed explanation of Yanghui triangle
JS convert text to language for playback