You need to sign in to do that
Don't have an account?

Trigger to calculate dates
Hi,
I'm looking for help with setting up a trigger to calculate the number of days from a start date to an end date...
I'm new to this stuff so any help would be appreciated.
Thanks,
Mitchell
I'm looking for help with setting up a trigger to calculate the number of days from a start date to an end date...
I'm new to this stuff so any help would be appreciated.
Thanks,
Mitchell
daysBetween(secondDate)Returns the number of days between the Date that called the method and the specified date.Signature
public Integer daysBetween(Date secondDate)
Parameters
secondDate
Type: Date
Return Value
Type: Integer
Usage
If the Date that calls the method occurs after the compDate, the return value is negative.
Example:
You can use date methods to calculate no of days between to days.
Date startDate = Date.newInstance(2008, 1, 1);
Date dueDate = Date.newInstance(2008, 1, 30);
Integer numberDaysDue = startDate.daysBetween(dueDate);
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm#apex_System_Date_daysBetween
Please mark this closed if this solves your purpose.
Thanks,
Kunal