In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "JavaScript how to store the date as milliseconds", the content is detailed, the steps are clear, the details are handled properly, I hope this "JavaScript how to store the date as milliseconds" article can help you solve your doubts, the following follow the editor's ideas slowly in depth, together to learn new knowledge.
JavaScript stores the date as milliseconds since 00:00:00 UTC (coordinated Universal time) on January 1, 1970.
Zero time is 00:00:00 UTC on January 1, 1970.
The current time is 1554166879383 milliseconds after January 1, 1970.
New Date (milliseconds)
New Date (milliseconds) creates a new date object at 00:00 plus milliseconds:
Example
Var d = new Date (0)
January 1, 1970 plus 100,000,000 milliseconds, approximately March 3, 1973:
Example
Var d = new Date (100000000000)
January 1, 1970 minus 100,000,000 milliseconds is approximately October 31, 1966:
Example
Var d = new Date (- 100000000000)
Example
Var d = new Date (86400000)
A day (24 hours) is 86,400,000 milliseconds.
Date method
When you create a Date object, you can manipulate it in many ways.
The date method allows you to use local time or UTC (universal or GMT) time to get and set the year, month, day, hour, minute, second, and millisecond of the date object.
The date method and time zone are described in the next chapter.
Show date
JavaScript (by default) outputs the date as a full-text string:
Wed Mar 25 2015 08:00:00 GMT+0800 (China Standard time)
When a date object is displayed in HTML, it is automatically converted to a string using the toString () method.
Example
D = new Date ()
Document.getElementById ("demo"). InnerHTML = d
Equivalent to:
D = new Date ()
Document.getElementById ("demo"). InnerHTML = d.toString ()
The toUTCString () method converts the date to a UTC string (a date display standard).
Example
Var d = new Date ()
Document.getElementById ("demo"). InnerHTML = d.toUTCString ()
The toDateString () method converts the date to a more readable format:
Example
Var d = new Date ()
Document.getElementById ("demo"). InnerHTML = d.toDateString ()
After reading this, the article "how JavaScript stores dates as milliseconds" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.