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:
Convert.ToDateTime(crmdatetime.Value)
DateTime.Parse(crmdatetime.Value)
For more information on the CrmDateTime, look in the SDK:
http://msdn2.microsoft.com/en-us/library/aa613542.aspx
2 comments:
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.
Jaber
ping back from http://www.castorsoft.com/articles/2008.2.11.htm
Post a Comment