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

JS sample code to determine the size of two times_javascript skills

WBOY
Release: 2016-05-16 17:02:04
Original
1154 people have browsed it

As shown below:

Copy code The code is as follows:

function validTime(startTime,endTime){
var arr1 = startTime.split("-");
var arr2 = endTime.split("-");
var date1=new Date(parseInt(arr1[0]),parseInt(arr1 [1])-1,parseInt(arr1[2]),0,0,0);
var date2=new Date(parseInt(arr2[0]),parseInt(arr2[1])-1,parseInt (arr2[2]),0,0,0);
if(date1.getTime()>date2.getTime()) { 
                 return false;
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