I'm trying to convert the Start Date and End Date, that are part of the standard SFDC Activity object, into hours. It looks like it is not possible to access these two fields (schema names StartDateTime and EndDateTime), from a formula field.

I need to obtain the total number of hours between those to fields. The idea is to use this value to make further calculations that are possible from a formula.

Anyone could give me an idea on how to accomplish this? Thanks in advanced!


Agree with @Michael, looks like you are talking about teh Event Object. If you want the number of hours you would go to

Setup -> Customize -> Activities -> Activity Custom Fields

Create a new formula field, of type number, and however many decimal places you want. The formula is below.

(DurationInMinutes / 60)

Just make sure you only add it to event layouts and not Task layouts

  • Thank you both for your replies. Yes, it is on the Event object. So, I need to write a trigger on the Event object to convert this, correct?No way to do this from a formula, I assume. Thanks again. – Carlos Naranjo May 7 '14 at 13:56
  • No need for a trigger. See the updated answer above. – Chris Duncombe May 7 '14 at 14:06
  • Thanks sfdc_ninja, that is exactly what I was looking for, much appreciated. – Carlos Naranjo May 8 '14 at 6:19

Are you looking at the "Event" object (which is a more specific type of Activity)? If so, it actually uses ActivityDateTime as the start time (unless it is an All Day event) and then either DurationInMinutes or EndDateTime to signify the length.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.