Time and milliseconds in js convert each other

Source: Internet
Author: User
Js Millisecond Time converted to date time varoldTime (newDate (& quot; 2012122520: 11: 11 & quot;) getTime (); if the number of milliseconds is not in the preceding format, you need to convert starttime & amp; 39; 2012-12-2520: 17: 24 & amp; 39 ;; starttime js converts Millisecond Time To Date time var oldTime = (new Date ("20:11:11 ")). getTime (); // get the number of milliseconds. // The time is not in the preceding format and needs to be converted. // starttime = '2017-12-25 20:17:24 '; starttime = starttime. replace (new RegExp ("-", "gm"), "/"); var starttimeHaoMiao = (new Date (starttime )). getTime (); // get the number of milliseconds [2] convert the number of milliseconds to the time var oldTime = (new Date ("20:11:11 ")). getTime (); // get the number of milliseconds var newTime = new Date (oldTime); // get the normal time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.