JS Countdown in the mobile end of the application

Source: Internet
Author: User

Test countdown on Mobile, convert time to milliseconds will appear nan on iphone

  "//On Android This can be obtained by the var date = ' 2017-06-12 13:12:13 ';  var time = new Date (date). GetTime ();  But it is not supported on the iphone and must be written like this: var time = new Date (Date.replace (/-/g, '/')). GetTime ();  Sometimes the time format to have a problem, you want to first split processing.  "' The following is the implementation code ' ' var sh;          function GetStartTime (StartTime) {var t = number (starttime+172800000)-Date.now ();//time difference in milliseconds var d = 0,      h = 0, m = 0, s = 0, ah = 0;          if (t >= 0) {d = Math.floor (T/1000/3600/24);          h = Math.floor (t/1000/60/60% 24);          m = Math.floor (t/1000/60% 60);          s = Math.floor (t/1000% 60);          Ah = d*24+h;          if (ah<10) {ah = ' 0 ' +ah;          } if (m<10) {m = ' 0 ' +m;          } if (s<10) {s = ' 0 ' +s; } return ' <span> ' +ah+ ' </span> ' + ' hours ' + ' <span> ' +m+ ' </span> ' + ' minutes ' + ' <span> ' +s+ ' </spa      N> ' + "seconds";        }else{return "activity is over"; ClearinTerval (SH);      }} sh=setinterval (settimeinterval,1000); function Settimeinterval () {var time = data. RargainU.createtime.split (".")    [0].replace (/-/g, '/');    var StartTime = new Date (time). GetTime ();  Insert $ (". Time") into the page. HTML (getstarttime (StartTime));  } settimeinterval (); ```

JS Countdown on the mobile side of the application

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.