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
TrimbleAgTrimbleAg 

Difference between two Times....

Ok so I got off the phone with premier support, and that didnt get me anywhere... So to the trusty boards...

 

I have created a field for first response, bascially it is updated on the first out bound e-mail or a click to call from the case via the CTI adapter.

 

All I need to do is report on the diffence between Created time stamp and the First Response time stamp...

 

Sounds simple, yes... But I can not get this to work from a reporting stand point, so I searched the forums and sounds like some are using another formula field to calaculate the difference.

 

Any Ideas???

 

Thanks!

Pat

Best Answer chosen by Admin (Salesforce Developers) 
SwarnasankhaSwarnasankha

What you can do is to create a Formula field with the Data Type as text and use the following code:

 

TEXT(FLOOR((First_Response_Time__c -  CreatedDate)/24)) & " Days " & 
TEXT(FLOOR((First_Response_Time__c -  CreatedDate) - (24*FLOOR((First_Response_Time__c -  CreatedDate)/24)))) & " Hours " & 
TEXT(FLOOR(((First_Response_Time__c -  CreatedDate) *60) - (FLOOR((First_Response_Time__c -  CreatedDate))*60))) & " Minutes"

 

The difference between First_Response_Time__c & CreatedDate will return the total Hours which could be used to display a combination of Days, Hours and Minutes. Please Note that you cannot reference Business Hours using Formula fields and therefore the end result is the time difference in Calendar Hours.

 

If you need to reference Business Hours, you will need to use an Apex Trigger to calculate the time difference.

All Answers

SwarnasankhaSwarnasankha

What you can do is to create a Formula field with the Data Type as text and use the following code:

 

TEXT(FLOOR((First_Response_Time__c -  CreatedDate)/24)) & " Days " & 
TEXT(FLOOR((First_Response_Time__c -  CreatedDate) - (24*FLOOR((First_Response_Time__c -  CreatedDate)/24)))) & " Hours " & 
TEXT(FLOOR(((First_Response_Time__c -  CreatedDate) *60) - (FLOOR((First_Response_Time__c -  CreatedDate))*60))) & " Minutes"

 

The difference between First_Response_Time__c & CreatedDate will return the total Hours which could be used to display a combination of Days, Hours and Minutes. Please Note that you cannot reference Business Hours using Formula fields and therefore the end result is the time difference in Calendar Hours.

 

If you need to reference Business Hours, you will need to use an Apex Trigger to calculate the time difference.

This was selected as the best answer
TrimbleAgTrimbleAg

Thanks for your help! Thats exactly what I was looking for! Much apprecaited!

 

Patrick

*werewolf**werewolf*

Incidentally, it sounds like you might want to look into using Salesforce.com's built-in Entitlements functionality if you have access to that.  Sounds to me like you're doing some SLA management, which is exactly what Entitlements are built for (and it would let you report on this stuff in business hours too).

ShahafShahaf

Entitlements might be an overkill, it seems like the formula posted resolved your need, if you wish to explore more options there are couple good solutions in the app exchange which deal with different areas of SLA quite elegantly.

Bob_zBob_z

Is there a way to ignore weekends using this formula?