CrmDateTime conversion to DateTime

When working with CrmDateTime, you'll notice that this type does have a .value attribute, but the type of this attribute is string. There is no attribute to get the .net class DateTime out of your CrmDateTime. If you do want to use a DateTime anyway, you'd easily need to convert it. You could use any of these:


For more information on the CrmDateTime, look in the SDK:


Jaber said...

Hello Ronald

I need your advise, how can I compare the dates in order to know the difference between them. e.g. difference between 1 january 2005
and 10 July 2005. Presently i am using this code in Javascript:

endDate = crmForm.all.new_contractend.DataValue.getMonth();
startDate = crmForm.all.new_contractstart.DataValue.getMonth();
alert(endDate - startDate);

It works fine for the same year and not with different years.

Thanks in advance.

Anonymous said...

ping back from