Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  68] [ 3]  / answers: 1 / hits: 135741  / 12 Years ago, sat, june 23, 2012, 12:00:00

I have two dates in javascript:



var first = '2012-11-21';
var second = '2012-11-03';


i would like make:



 if(first > second){
//...
}


how is the best way for this, without external library?


More From » date

 Answers
79
if( (new Date(first).getTime() > new Date(second).getTime()))
{
----------------------------------
}

[#84715] Thursday, June 21, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
milo

Total Points: 62
Total Questions: 99
Total Answers: 97

Location: Sweden
Member since Mon, May 8, 2023
1 Year ago
;