function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kirankumar reddy punurukirankumar reddy punuru 

how to add days to date field to by calculating difference between two dates

Hi,
I am having one field called start date which is of type date field  i need to update the field based on the conditiotn and add days  to start date

Like This if(x=y)
{ start date = (today()- end date)}
but iam getting an error due to conversion type, can some help  me to choose any function avl to do this..

thanks..
Jithin Krishnan 2Jithin Krishnan 2
Can you please post your code? I can help you get rid of the error.
Ketankumar PatelKetankumar Patel
Hi Kiran,

If you need this for Apex then below snippet code would help 
IF (X == Y){
     Start_Date__c = Start_Date__c.addDays(System.today().daysBetween(End_Date__c));
}