js to get the current time (including today, tomorrow and yesterday)

炎欲天舞
Release: 2017-08-04 16:00:31
Original
2847 people have browsed it

//昨天的时间 var day1 = new Date(); day1.setTime(day1.getTime()-24*60*60*1000); var s1 = day1.getFullYear()+"-" + (day1.getMonth()+1) + "-" + day1.getDate(); //今天的时间 var day2 = new Date(); day2.setTime(day2.getTime()); var s2 = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate(); //明天的时间 var day3 = new Date(); day3.setTime(day3.getTime()+24*60*60*1000); var s3 = day3.getFullYear()+"-" + (day3.getMonth()+1) + "-" + day3.getDate(); //拼接时间 function show(){ var str = "" + s1 + "至" + s2; return str; } //赋值doubleDate $('#dateS').val(show());
Copy after login

The above is the detailed content of js to get the current time (including today, tomorrow and yesterday). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!