CRM 2011 JavaScript date

How to add a year to a date field.

– var StartDate = Xrm.Page.getAttribute(“astartdate”).getValue();
– StartDate = new Date(StartDate.getFullYear() + 1, StartDate.getMonth(), StartDate.getDate());


2 Responses to CRM 2011 JavaScript date

  1. U Modi says:

    I just want to add a day in the start date??? can you provide me the syntax to add a day only?

    • Thabiso says:

      var StartDate = Xrm.Page.getAttribute(“createdon”).getValue();
      StartDate = new Date(StartDate.getFullYear(), StartDate.getMonth(), StartDate.getDate() + 1); //Add 1 to the getDate()

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Workflow Elements by Aiden Kaskela

Microsoft Business Solutions MVP (CRM), Contractor, Evangelist


Real Experiences from Analyzing, Architecting, developing and working with Dynamics CRM, Dynamics 365 and sometimes .net

Mark Margolis's Blog

It's about Software, CRM, Product Development and sometimes Food.


Gareth Tucker on Microsoft Dynamics CRM

Donna Edwards

Sharing my Journey with Microsoft Dynamics 365 Business Solutions

The Blog

The latest news on and the WordPress community.

%d bloggers like this: