locked
Add minutes to DateTime RRS feed

  • Question

  •  

    Hi

         How is it possible in javascript to add the duration to datetime. I know the duration is in minutes it cant be added to dateTime ?

    Tuesday, July 15, 2008 1:05 PM

Answers

  • I am assuming you are talking about one of the activity entity.  The code below will let you to add the duration to the minute of the due date time.  If the date is blank, it will be set to today's date.

     

    var oDate = crmForm.all.scheduledend.DataValue;

    if(oDate == null)
    {
       oDate = new Date();
    }

    var hour = oDate.getHours();
    var minute = oDate.getMinutes() + crmForm.all.actualdurationminutes.DataValue;

    oDate = oDate.setHours(hour, minute,0);

    crmForm.all.scheduledend.DataValue = oDate;

     

     

     

    Tuesday, July 15, 2008 1:30 PM