How to compare time in javascript?

前端 未结 4 1739
忘掉有多难
忘掉有多难 2020-12-31 04:14

I have two time in the format \"HH:MM\" i want to compare them i have the following code to get the time of now in my format:

current_time = new Date();
hour         


        
4条回答
  •  春和景丽
    2020-12-31 04:57

     if(Date.parse('01/01/2011 10:20:45') == Date.parse('01/01/2011 5:10:10')) {
      alert('same');
      }else{
    
      alert('different');
    
      }
    
    The 1st January is an arbitrary date, doesn't mean anything.
    

提交回复
热议问题