date Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/date/ Microsoft Dynamics CRM . Microsoft Power Platform Sat, 15 Feb 2014 08:52:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32 date Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/date/ 32 32 176351444 CALCULATE NO OF MONTHS ( FIELD DATE – TODAY ) USING JAVASCRIPT IN MS CRM 2011 , 2013 http://microsoftdynamics.in/2014/02/15/calculate-no-of-months-field-date-today-using-javascript-in-ms-crm-2011-2013/ Sat, 15 Feb 2014 08:52:00 +0000 http://microsoftdynamics.in/2014/02/15/calculate-no-of-months-field-date-today-using-javascript-in-ms-crm-2011-2013/ /// <reference path=”XrmPage-vsdoc.js” /> function calMonths() {     //get the startdate field value in variable     var startday = xrm.page.getAttribute( “fieldname”).getValue();     // get todays date in variable     var today = new date();     // get the value of one day in (mili_second * second * min * hours)     var one_dat = 1000 * 60 * 60 * 24;     // get no of days in month...

The post CALCULATE NO OF MONTHS ( FIELD DATE – TODAY ) USING JAVASCRIPT IN MS CRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
/// <reference path=”XrmPage-vsdoc.js” />
function calMonths() {
    //get the startdate field value in variable
    var startday = xrm.page.getAttribute( “fieldname”).getValue();
    // get todays date in variable
    var today = new date();
    // get the value of one day in (mili_second * second * min * hours)
    var one_dat = 1000 * 60 * 60 * 24;
    // get no of days in month
    var one_month = 30;
    //get time
    var starttime = startday.getTime();
    var currenttime = today.getTime();

    var diffrence = math.abs(currenttime – starttime);
    noofdays = Math.round(diffrence / one_day);
    noofmonths = Math.round(noofdays / one_month);
    // set the noofmonths value in field
    xrm.page.getAttribute( “new_calmonths”).setValue(noofmonths);

}


SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post CALCULATE NO OF MONTHS ( FIELD DATE – TODAY ) USING JAVASCRIPT IN MS CRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2843