Calculate Number of Days between two Dates in MS CRM


Some time we need to calculate number of days between two dates in crm, we can easily do this using below JS script

var d1=crmForm.all.FirstDate.DataValue;
var d2=crmForm.all.SecondDate.DataValue;
var DayValue=1000*60*60*24;

alert(Math.ceil((d2.getTime()-d1.getTime())/DayValue));

Advertisements

2 Comments

Filed under JS Script

2 responses to “Calculate Number of Days between two Dates in MS CRM

  1. Michiel

    Thanks a lot!

  2. Praveen

    Thanks dude.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s