locked
CRM Javascript Date Functions RRS feed

  • Question

  • Hi all,

      I have a Javascript Date object with the datetime translated from UTC to the current user timestamp, but I need to obtain the day of the week of this datetime according to this timestamp, not according to the local time from the machine and not according to UTC. Can anyone help me?

    Thanks,

    David N.

    Tuesday, January 27, 2015 10:34 AM

All replies

  • function checkEstimatedCloseDate() {
        var date = Xrm.Page.getAttribute("estimatedclosedate").getValue();
        if (date != null) {
            var today = new Date();
            var currentDate = today.getDate().toString() + "/" + (today.getMonth() + 1).toString() + "/" + today.getFullYear().toString();
            var dateWithNoTime = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
            if (Xrm.Page.getAttribute("estimatedclosedate").getValue() < dateWithNoTime) {
                alert("Estimated Close Date Cannot Before " + currentDate);
                Xrm.Page.getAttribute("estimatedclosedate").setValue(null);
                event.returnValue = false;
            }
        }
    }
    


    Regards Faisal

    Tuesday, January 27, 2015 2:19 PM