This blog post explains how a formula field can display a time difference of two DateTime fields to Days:Hours:Minues format.
Use Case: Show the Time Difference between Now() and Record Created Date.
IF( TEXT( FLOOR(( NOW() - Record_Created_Date__c )) ) & IF(FLOOR(( NOW() - Record_Created_Date__c )) > 1, " Days,", " Day,")
& ' ' & TEXT( FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24, 24) ) ) &
IF(FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24, 24) ) > 1, " Hours,", " Hour,")
& ' ' & TEXT( FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24 * 60, 60)) ) &
IF(FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24 * 60, 60)) > 1, " Minutes", " Minute"))
Use Case: Show the Time Difference between Now() and Record Created Date.
IF( TEXT( FLOOR(( NOW() - Record_Created_Date__c )) ) & IF(FLOOR(( NOW() - Record_Created_Date__c )) > 1, " Days,", " Day,")
& ' ' & TEXT( FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24, 24) ) ) &
IF(FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24, 24) ) > 1, " Hours,", " Hour,")
& ' ' & TEXT( FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24 * 60, 60)) ) &
IF(FLOOR( MOD(( NOW() - Record_Created_Date__c ) * 24 * 60, 60)) > 1, " Minutes", " Minute"))
No comments:
Post a Comment