Home > Web Front-end > JS Tutorial > body text

js determines the incoming time and current time size instance

小云云
Release: 2018-01-13 09:27:02
Original
1631 people have browsed it

This article mainly shares an example of js judging the incoming time and current time size (super simple). It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.

The examples are as follows:

//判断时间是否过期
function judgeTime(time){
var strtime = time.replace("/-/g", "/");//时间转换
//时间
var date1=new Date(strtime);
//现在时间
var date2=new Date();
//判断时间是否过期
return date1<date2?true:false;
}
Copy after login

Have you learned it? Hurry up and try it out.

Related recommendations:

Detailed explanation of the conversion method between js timestamp and date format

Detailed introduction to c# timestamp Code sharing with js timestamp mutual conversion method

js time control only displays year and month

The above is the detailed content of js determines the incoming time and current time size instance. 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
Popular Tutorials
More>
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!