You need to sign in to do that
Don't have an account?
Date Methods
Hi,
I am trying to use the date method to modify a date but am unable to do so. The details are
Position is a custom object
Opendate is a field with date data type
Count is a field with number date type
Closeddate is a field with date data type
I am trying to calculate the closedate from the Opendate and Count but i am not able to do so. The code is a follows
double c = position.Count__c;date mydate = date.valueof(position.Opendate__c);date newdate = mydate.adddays(c);position.Cdate__c = newdate;
If I replace the variable c with a constant number as 1 or 2, it performs the operation properly. I am unable to pass the value of Count there. How can i get this done.
Thanks
KD
Hi KD9500,
the Method 'Date.addDays()' requires an Integer, but your Variable 'c' has the type double.
Try the following code :
position.Cdate__c = position.Opendate__c.addDays(Integer.valueOf(position.Count__c));
All Answers
Hi KD9500,
the Method 'Date.addDays()' requires an Integer, but your Variable 'c' has the type double.
Try the following code :
position.Cdate__c = position.Opendate__c.addDays(Integer.valueOf(position.Count__c));
Thanks Michael..
Your option to change the value to integer worked. But I was not able to convert the double to integer, I changed 'Count__c' data type to string and then changed it to integer, it worked properly
Thanks again for the suggestion.
KD