cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating between two Date/Time fields?

Sushi Chef
Sushi Chef

Calculating between two Date/Time fields?

I'm working on a metric report for showing the time elapsed from entry to completion of a work order. However, this particular workflow process is entering invoices in as work orders so the total amount of time elapsed is in mere minutes. I've attempted to get this to work by doing the following:

1. Created a new date field on the work order

     -This field is updated with the Last Modified Date through a workflow rule and workflow update whenever the WO is placed into an Order Status of 'Approval Review'

2. Created a new formula field on the work order with the following formula:

     : WO_Entry_To_Submit_Approval_Time__c  -  CreatedDate

     -This formula looks at the field that I updated in #1 and SHOULD produce the time in mm:ss that has elapsed between the two

The sample I did was created on 12/10 and put into approved status on 12/18 and produced the following result:

WO Elapsed.jpg

‌This represents 8.5 days. Can I formulate down to mm:ss as my output?

Message 1 of 5
0 Likes
4 Replies
Line Chef
Line Chef

Re: Calculating between two Date/Time fields?

I didn't test this directly so there might be a formatting problem in too many ')'

TEXT( FLOOR((WO_Entry_To_Submit_Approval_Time__c  -  CreatedDate) * 24) )  & ':' & TEXT (  FLOOR( (  ((WO_Entry_To_Submit_Approval_Time__c  -  CreatedDate) * 24) - FLOOR((WO_Entry_To_Submit_Approval_Time__c  -  CreatedDate) * 24) ) * 60) )

Message 2 of 5
Sushi Chef
Sushi Chef

Re: Calculating between two Date/Time fields?

Thank you! I will try this out.

Message 3 of 5
0 Likes

Re: Calculating between two Date/Time fields?

Hi Joshua Phillips​, was your question resolved using the approach by Chris?  If so, please let us know at your earliest convenience and mark your question as "Answered" so others may benefit from it!  We look forward to hearing from you!

Message 4 of 5
0 Likes
Highlighted
Fry Chef
Fry Chef

Re: Calculating between two Date/Time fields?

I didn't see if you had replied, but there is another link that can possibly help you if the age of the record is going to be more than minutes. It would allow you to do Days, hours, minutes, seconds.

I have not tested this myself for quite some time, but I remember doing it before and it worked.

calculation across date/time fields (including days and hours) - Answers - Salesforce Success Commun...

Message 5 of 5
0 Likes