2

What is a formula to calculate the difference between two date/time fields in hours:minute (both date/time values in 12-hour clock format)?

  • What have you tried so far and where are you stuck? This documentation may help – BarCotter Feb 6 '15 at 11:53
  • suppose Date1: 2/4/2015 8:47 PM and DateTime2: 2/6/2015 2:37 AM I want difference between these dates in hours and minute. can you please help me to create formula field – pornima Feb 6 '15 at 12:10
5

The examples which are mentioned in the documentation contains the following:

Finding the Elapsed Time Between Date/Times

To find the difference between two Date values, subtract one from the other like so: date_1 — date_2 to return the difference in days.

Finding the elapsed time between two Date/Time values is slightly more complex. For simplicity, the custom field Diff_c refers to the difference between two Date/Time values. Since Diff_c is a number, you can use this formula to convert it to days, hours, and minutes.

IF(
  Diff_c > 0 ,
  TEXT( FLOOR( Diff_c ) ) & " days "
  & TEXT( FLOOR( MOD( Diff_c * 24, 24 ) ) ) & " hours "
  & TEXT( ROUND( MOD( Diff_c * 24 * 60, 60 ), 0 ) ) & " minutes",
  ""
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.