title: Checking whether current date time is greater than or equal to date and time from the database
body: <p>I am creating an application for a training management system. I have to check if thge current date and time is greater than the date and time in the db. If so, hide some buttons. But my code is not working. </p>
  
  <p>I don't know what I have done wrong. I am stuck on this for hours now. The date in db is in the format <code>dd-mm-yyyy</code> and time is in <code>H:i</code>. Here is what I've tried:</p>
  
  <pre><code>    end_Time = data.end_Time; // to get the time from db
      var CurrentDate = new Date();
      var arrDate = end_Time[0].end_date.split("-");
      var dbDate = new Date(arrDate[2], arrDate[1] - 1, arrDate[0]);
      var hours = CurrentDate.getHours();
      var minutes = ("0" + (CurrentDate.getMinutes())).slice(-2);
      var Current_Time = hours + ":" + minutes;
  
      if (dbDate &lt; CurrentDate) {
          if ((end_Time[0].end_time) &lt; Current_Time) {
              $("#updateTrainingButton").hide();
              $("#sendInvitationButton").hide();
              $("#cancelTrainingButton").hide();
          }
      }
  </code></pre>