First make sure both fields are set the correct input format of "Date", and the result field with the formula should be set to "Number".
Now simply do a subtraction between the two fields and you will get the difference.
The if the two dates have a date element (ex. yyyy/MM/dd) in the date format, the result will be in number of days. Otherwise if the dates does not have a date element (ex. HH:mm), the result will be the number of minutes.
If you need to translate the result from minutes, you can simply divide the result by 60 with the formula.
You can also check our documentation regarding using formulas to calculate dates and times here.