Pages

Monday 13 January 2014

JScript to Check the condition between two dates dates

JScript to Check the condition between two dates dates


The above Snippet code can be used to get compare the two dates in CRM 2011.


function date()
{
var t=new Date(); //getting current date
var d = t.getDate();
var m = t.getMonth()+1;   //January months starts with 0
var y=t.getFullYear();
var date=Xrm.Page.getAttribute("hrm_dateofbirth").getValue();  //getting date from a field
var dd=date.getDate();
var mm = date.getMonth();
var yy = date.getYear();

if(date > t) //checking condition for date difference i.e give date must not exceed current date
alert("Invalid Date")
}

No comments:

Post a Comment