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
dtookerdtooker 

Calculation for time

Hi
I have a BeginDateTime and a EndDateTime also with a time offset in Hours.  Is there a formula where I can take the EndDateTime subtract the BeginDateTime + the TimeOffset in hours to get a total time.  Here is an example
 
BeginDateTime 11/1/06 9:35 PM
EndDateTime 11/1/06 11:45 PM
TimeOffset = 2
 
So I want to take 11/1/06 11:45PM - (11/1/06 9:35PM + 2hrs) should get calculated number field of .17 for the total hours or 10 minutes.
 
here is what my formula looks like now
(({!End_Date__c} - ({!Begin_Date__c} +  {!Time_Offset__c})   )     * 24
Thank you
dtookerdtooker

In case anyone else has this problem I have come up with working solution.  It looks like you need to divide the hours (TimeOffset)  by 24.  The end result was:

 

(  {!Begin_Date__c} - ( {!Event_Date__c} - ({!Time_Offset__c}/24))  )   * 24

TonkaCruiserTonkaCruiser

Here is an HH:MM:SS formula that some might also find interesting.  It is basic amount of time since created but can be modified to show the time open for a case if needed.

 

Text(FLOOR((NOW() - {!CreatedDate}) * 24))

&":"&Text(FLOOR(((NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() -{!CreatedDate}) * 24))* 60))

&":"&Text(FLOOR((((NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() - {!CreatedDate}) * 24 ))* 60 - FLOOR(((NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() -{!CreatedDate}) * 24 )) * 60 )) * 60 ))

 

Chris

smiley2345smiley2345
Chris,
I really appreciate your post.  I was wondering if you could help me with a varation.  What if I had a field that I had assigned time to.
 
Example Phone Call Time.  I would place 1 hour; 2 hour ect. in this box.  Then I want to cummulate my time based on that.
 
TTL Time = TTL_Time + Phone Call Time. 
 
I thought I had this worked out, but the time resets everytime I click edit on the page layout. 
 
Any help is much appreciated.
Kim