当前位置:网站首页>Moment. JS to UTC format
Moment. JS to UTC format
2022-06-24 01:45:00 【HoneyMoose】
In the use of Moment.js Convert to UTC Format time , We may meet 2 A little question .
If you use
('2021-11-01T19:39:00.000').utc().format();
To carry out UTC Time conversion , You will find that your input time and output time are different .
Change time zone
If as described above , In the result , We see the following figure
Input time , We actually use UTC Time for , But after the conversion is successful , We will find that 2 There is a time deviation .
The reason for this deviation is the current time of your computer .
We can see from the figure below :
When the object is initialized , Whether it is UTC The time parameter options are false.
Therefore, there will be deviation .
If you know the input time is UTC In time , You can use the following code :
moment.utc('2021-11-01T19:39:00.000').format();
If you initialize an object in this way , The time stamp of the object will be marked UTC Time .
format Function has no milliseconds
Smart you may see , If you use format() Function to format ISO There are no milliseconds in time .
If you want your time object to have millisecond data after formatting the output .
The method you should use is :
toISOString()
Look at the following code :
moment.utc('2021-11-01T19:39:00.000').toISOString()
As shown in the figure below , After the following code formats the output, there will be millisecond data :
This is what we need to pay attention to in actual use .
边栏推荐
- Horizontal movement of Intranet penetration -- password spray attack from domain to domain
- How to do AI speech synthesis? How to download the voice of AI speech synthesis?
- This invincible design can analyze and operate any mathematical expression
- [read together] Web penetration attack and defense practice (I)
- [SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)
- AES encryption analysis of CNKI academic translation
- Common e-commerce data index system
- 4-data persistence and shared interconnection
- Easynvr background channel list timing request touchstreamclient interface optimization
- Application of "popular science" UAV and video technology in fire scene
猜你喜欢

I, a 27 year old female programmer, feel that life is meaningless, not counting the accumulation fund deposit of 430000
![[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)](/img/c8/f6c2a62b8ab8fa88bd2b3d8f35f592.jpg)
[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)
![[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)](/img/b5/a8c4bbaf868dd20b7dc9449d2a4378.jpg)
[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)

It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)
随机推荐
[planting grass by technology] three big gifts prepared by Tencent cloud for you on the double 11, welcome to touch~
Horizontal movement of Intranet penetration -- password spray attack from domain to domain
Summary of various situations in which easycvr cannot use voice intercom function
How does smart digital operation get through offline collection and online marketing?
How does Huawei weautomate RPA achieve the natural growth of government enterprise automation?
Gin framework: implementing distributed log tracing
Gin framework: implementing timeout Middleware
Online and offline integrated operation of channel sales system in the home furnishing industry to promote product update and iteration
Common e-commerce data index system
What are the selected CDN content acceleration scenarios of Tencent cloud?
CLB O & M & operation best practices - big insight into access logs
Dart series: generics in dart classes
Best practices cloud development cloudbase multi environment management practices
How to write the domain name of trademark registration? What is the process of trademark and domain name registration?
Cost composition and calculation method of system software
DCOM horizontal movement of Intranet penetration
[JS reverse hundred examples] md5+aes encryption analysis of an easy payment password
NFS operations and deployment
Dart series: using packages in dart
How to use the speech synthesis assistant? Does speech synthesis cost money?