Home >Web Front-end >JS Tutorial >js determines the incoming time and current time size instance

js determines the incoming time and current time size instance

小云云
小云云Original
2018-01-13 09:27:021660browse

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;
}

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!

Statement:
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