我无法通过使用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;
答案 0 :(得分:1)
日期时间以UTC格式存储,但显示在您当地的时区。你是javascript必须确定你的时区,然后执行转换为UTC,然后在你的FetchXml中使用该值。
检查这些问题,因为答案是相同的,即使他们试图做的是不同的: