JS Stamp and PHP timestamp time conversion

Source: Internet
Author: User

Question: How much time is left, if only PHP is used to output, but the dynamic effect is not visible.
Workaround, use the acquired time minus the current time JS time format conversion
PHP time commodity distance seconds to kill time
<input name= "test01" value= "1472572800/x x/of the start of the day" >
<div id= "Showtimes" ></div>
functionShow_cur_times () {//Get Current date    varDate_time =NewDate (); varCur_time =$ ("[Name= ' test01 ']"). Val () *1000; Gets the timestamp to change the millisecond to 000 displayvartimestamp=NewDate (). GetTime (); varTimestampend = Cur_time-timestamp; varNewTime =NewDate (timestampend); varDay=math.floor (timestampend/(24*3600*1000));//calculate the number of hours    varleave1=timestampend% (24*3600*1000);//number of milliseconds remaining after counting days    varHours=math.floor (leave1/(3600*1000));//calculate the number of minutes difference    varleave2=leave1% (3600*1000);//number of milliseconds remaining after hours of calculation    varMinutes=math.floor (leave2/(60*1000));//calculate the number of seconds difference    varleave3=leave2% (60*1000);//Count the number of milliseconds left after the number of minutes    varSeconds=math.round (leave3/1000);varDate_str = day+ "Day" +hours+ "+minutes+" minute "+seconds+" seconds "; //displayed in a container with ID showtimesdocument.getElementById ("Showtimes"). innerhtml=date_str;}//Set 1-second call once Show_cur_times functionSetInterval (show_cur_times,1000);
Dynamic 67 days 12:10 21 seconds

JS Stamp and PHP timestamp time conversion

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.