title: Compare Datetime issue with dynamic CRM 2013 datetime data
body: <p>I am Unable to fetch date by compairing datetime with Dynamic CRM 2013.
  Below time format am using in my code even if i am using YYYY-MM-DD HH:MM format its fetching data based on date only not considering time .
  Can any have idea about this.</p>
  
  <pre><code>var SDate = new Date(document.getElementById("FromDate").value);
  var EDate = new Date(document.getElementById("Todate").value);
  var e = document.getElementById("FromTime");
  var fromtime = e.options[e.selectedIndex].value;
  e1 = document.getElementById("ToTime");
  var totime = e1.options[e1.selectedIndex].value;
  var Smonth = (SDate.getMonth() + 1);
    if (Smonth &lt;= 9) {
      Smonth = "0" + Smonth;
  }
  
   var Emonth = (EDate.getMonth() + 1);
   if (Emonth &lt;= 9) {
       Emonth = "0" + Emonth;
   }
  
   var strtDate = SDate.getFullYear() + "-" + Smonth + "-" + SDate.getDate() + "T" + fromtime.substr(0, 2) + ":" + fromtime.substr(2, 2) + ":" + "00";
  var EndDate = EDate.getFullYear() + "-" + Emonth + "-" + EDate.getDate() + "T" + totime.substr(0, 2) + ":" + totime.substr(2, 2) + ":" + "00";**
  </code></pre>
  
  <p>fetch XML code :</p>
  
  <pre><code>query = "" + "&lt;fetch version='1.0' output-format='xml-platform' mapping='logical'                distinct='false'&gt;" +
  "&lt;entity name='ccx_vitals'&gt;" +
   "&lt;attribute name='ccx_bpdiastolic' /&gt;" +
  "&lt;attribute name='ccx_bpsystolic'/&gt;" +
  "&lt;attribute name='ccx_glucose' /&gt;" +
   "&lt;attribute name='ccx_pulse' /&gt;" +
   "&lt;attribute name='ccx_temperature' /&gt;" +
   "&lt;attribute name='ccx_tempunitofmeasure' /&gt;" +
   "&lt;attribute name='ccx_tempmeasuremethod' /&gt;" +
   "&lt;attribute name='ccx_height' /&gt;" +
   "&lt;attribute name='ccx_heightunittype' /&gt;" +
   "&lt;attribute name='ccx_weight' /&gt;" +
   "&lt;attribute name='ccx_weightunitofmeasure' /&gt;" +
   "&lt;attribute name='ccx_bmi' /&gt;" +
   "&lt;attribute name='ccx_painlevel' /&gt;" +
   "&lt;attribute name='ccx_vitaldate' /&gt;" +
   "&lt;attribute name='ccx_oxygen' /&gt;" +
   "&lt;attribute name='ccx_heartrate' /&gt;" +
   "&lt;attribute name='ccx_respiratoryrate' /&gt;" +
   "&lt;attribute name='ccx_vitalsid' /&gt;" +
   "&lt;attribute name='ccx_oxygensaturation' /&gt;" +
   "&lt;attribute name='ccx_oxygendeliverydevice' /&gt;" +
  "&lt;attribute name='ccx_bpqualifier' /&gt;" +
   "&lt;filter type='and'&gt;" +
  "&lt;condition attribute='statecode' operator='eq' value='0' /&gt;" +
  "&lt;condition attribute='ccx_contact' operator='eq' value='" + clientId + "' /&gt;";
  if (document.getElementById("FromDate").value != '' &amp;&amp;     document.getElementById("Todate").value != '')
  {
  query = query + "&lt;condition attribute='ccx_vitaldate' operator='on-or-after' value='" +     strtDate + "'/&gt;" +
  "&lt;condition attribute='ccx_vitaldate' operator='on-or-before' value='" + EndDate +         "'/&gt;";
   }
  query=query+ "&lt;/filter&gt;" +
  "&lt;order attribute='ccx_vitaldate' descending='true' /&gt;" +
  "&lt;/entity&gt;" +
   "&lt;/fetch&gt;";
   return query;
  </code></pre>