Reply
Visitor
ozdaniel
Posts: 1

Date Issue (Adding two dates)

[ Edited ]

Hi all,

 

I have two fields Average_Sales_Cycle__c and Booking_Date__c.

Average_Sales_Cycle__c        Number(18, 0)

Booking_Date__c                     Date

 <a href="http://securecashadvanceonline.com/"> loans personal </a>

I want to add both these fields and get the added value as a date. I am querying these two fields in a btach apex and trying to add both like below.

 

Date BookingDate=opp1.Date_Opened__c+opp1.Average_Sales_Cycle__c

 

but getting an error "Date arithmetic expressions must use Integer or Long arguments at line 85 column 40".

 

How can I achieve this and I also want to compare the month of BookingDate against 1 to 12.

 

Please let me know how this can be achieved.

 

Thanks

Super Contributor
chamil
Posts: 618

Re: Date Issue (Adding two dates)

Try these changes

 

Date BookingDate=opp1.Date_Opened__c.addDays(opp1.Average_Sales_Cycle__c);

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.