+ Start a Discussion
buggs sfdcbuggs sfdc 

Countdown Hours and refreshes every hour and minute

HI,

I have to count business hours between two dates,below is formula which is working fine.
But on addition i have to count down every hour or minute on the same field.
I really appreciate your quick responses.
8 *
( (5*FLOOR(( DATEVALUE( IF(ISNULL(SLA_Date__c), NOW(), SLA_Date__c) ) -DATE(1996,01,01))/7) 
        +
        MIN(5, 
        MOD(DATEVALUE( IF(ISNULL(SLA_Date__c), NOW(), SLA_Date__c) )-DATE(1996,01,01), 7) +
        MIN(1, 24/ 8 *(MOD( IF(ISNULL(SLA_Date__c), NOW(), SLA_Date__c) -DATETIMEVALUE('1996-01-01 08:30:00am'), 1)))
        ))

        -

        (5*FLOOR((DATEVALUE( CreatedDate+ MAX(DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 08:30:00am") - CreatedDate,0) )-DATE(1996,01,01))/7) +
        MIN(5, 
        MOD(DATEVALUE( CreatedDate+ MAX(DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 08:30:00am") - CreatedDate,0) )-DATE(1996,01,01), 7) +
        MIN(1, 24/ 8 *(MOD( CreatedDate+ MAX(DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 08:30:00am") - CreatedDate,0) -DATETIMEVALUE('1996-01-01 08:30:00am'), 1)))))
        )

 
buggs sfdcbuggs sfdc
Vinod,

I tried both and some how i strucked up to resolve it.
Here iam getting the total value like 16 hours,but it has to refresh every minute.
For example total hours for case resultion is 16 hours now and if i check after 1 hour it should show me 15 hours and after 2 hours it should be 14 hours.