【问题标题】:Compare Datetime issue with dynamic CRM 2013 datetime data将日期时间问题与动态 CRM 2013 日期时间数据进行比较
【发布时间】:2014-04-13 04:52:20
【问题描述】:

我无法通过将 datetime 与 Dynamic CRM 2013 进行比较来获取日期。 即使我使用的是 YYYY-MM-DD HH:MM 格式,它在我的代码中使用的时间格式也低于时间格式,它仅基于日期而不考虑时间来获取数据。 任何人都可以对此有所了解。

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 <= 9) {
    Smonth = "0" + Smonth;
}

 var Emonth = (EDate.getMonth() + 1);
 if (Emonth <= 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";**

获取 XML 代码:

query = "" + "<fetch version='1.0' output-format='xml-platform' mapping='logical'                distinct='false'>" +
"<entity name='ccx_vitals'>" +
 "<attribute name='ccx_bpdiastolic' />" +
"<attribute name='ccx_bpsystolic'/>" +
"<attribute name='ccx_glucose' />" +
 "<attribute name='ccx_pulse' />" +
 "<attribute name='ccx_temperature' />" +
 "<attribute name='ccx_tempunitofmeasure' />" +
 "<attribute name='ccx_tempmeasuremethod' />" +
 "<attribute name='ccx_height' />" +
 "<attribute name='ccx_heightunittype' />" +
 "<attribute name='ccx_weight' />" +
 "<attribute name='ccx_weightunitofmeasure' />" +
 "<attribute name='ccx_bmi' />" +
 "<attribute name='ccx_painlevel' />" +
 "<attribute name='ccx_vitaldate' />" +
 "<attribute name='ccx_oxygen' />" +
 "<attribute name='ccx_heartrate' />" +
 "<attribute name='ccx_respiratoryrate' />" +
 "<attribute name='ccx_vitalsid' />" +
 "<attribute name='ccx_oxygensaturation' />" +
 "<attribute name='ccx_oxygendeliverydevice' />" +
"<attribute name='ccx_bpqualifier' />" +
 "<filter type='and'>" +
"<condition attribute='statecode' operator='eq' value='0' />" +
"<condition attribute='ccx_contact' operator='eq' value='" + clientId + "' />";
if (document.getElementById("FromDate").value != '' &&     document.getElementById("Todate").value != '')
{
query = query + "<condition attribute='ccx_vitaldate' operator='on-or-after' value='" +     strtDate + "'/>" +
"<condition attribute='ccx_vitaldate' operator='on-or-before' value='" + EndDate +         "'/>";
 }
query=query+ "</filter>" +
"<order attribute='ccx_vitaldate' descending='true' />" +
"</entity>" +
 "</fetch>";
 return query;

【问题讨论】:

    标签: crm dynamics-crm-2013


    【解决方案1】:

    日期时间以 UTC 格式存储,但以您当地的时区显示。您的 javascript 必须确定您的时区,然后执行到 UTC 的转换,然后在您的 FetchXml 中使用该值。

    查看这些问题,因为答案是相同的,即使他们尝试做的事情不同:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-03
      • 1970-01-01
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-24
      相关资源
      最近更新 更多