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

How to get the difference between DateTime fields in Apex trigger?
Hi,
I have two DateTime fields ApprovedAt, SubmittedAt.
What I am trying to do is I would like to calculate turn around time by using this -> (ApprovedAt - SubmittedAt)
How we can do that in APex trigger? And what should be the type of field TurnAroundTime ?
I appreciated your help.
I have two DateTime fields ApprovedAt, SubmittedAt.
What I am trying to do is I would like to calculate turn around time by using this -> (ApprovedAt - SubmittedAt)
How we can do that in APex trigger? And what should be the type of field TurnAroundTime ?
I appreciated your help.
Date startDate = Date.newInstance(2008, 1, 1); Date dueDate = Date.newInstance(2008, 1, 30); Integer numberDaysDue = startDate.daysBetween(dueDate);
Also refer below link.
http://sfdcsrini.blogspot.com/2014/08/different-date-time-calculation-steps.html
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya
All Answers
Date startDate = Date.newInstance(2008, 1, 1); Date dueDate = Date.newInstance(2008, 1, 30); Integer numberDaysDue = startDate.daysBetween(dueDate);
Also refer below link.
http://sfdcsrini.blogspot.com/2014/08/different-date-time-calculation-steps.html
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya
Hi Sujit,
you can refer below code which will help you to find difference in Days,Hours,Minutes,Second.
If you want to show DD HH:MM:SS then you can create string field and you can capture in particlar formate with help of typecasting values in string and merge those strings in one field(TEXT).
If you want store number of days in Number field type then try below code it will help.
Please try and let me konw if I can help further.
Thanks,
Keyur Modi
@Keyur - Appreciated you time and help