I have a field “time_diff” and 2 date_time fields , “date1” and “date2”.
time_diff is a calculated field and i m using the following formula :
@time(date2) - @time(date1)
date2 > date1.
The problem is that if for example date1 contains 5th Feb, 07 3.00 PM and date2 contains 6th Feb '07 9.00 AM then the above formula gives 336 mins that is 5.6 hrs but it should give 1080 mins 0r 18 hrs or simply i need that in the output.
Time-date. For a timedate value such as @Now or [10/31/93 12:00:00], @Time removes the date portion of the value, leaving only the time.
so as you are using @time function on date1, date2 fields…it removes date from these fields and only find the difference between the two times…i.e. difference between 9:00 AM to 3:00 PM (6 hrs).
try without using @time function i.e. date2 - date1
ok let suppose , we have 2 date fields that displays only time , time 1 and time 2 , time 1 contains 3:27 PM and time 2 contains 9:50 AM then , time 2 - time 1 gives -5.6 hrs and time 1 - time 2 gives 5.6 hrs.This should not be like that.we can fix it after subtracting 5.6 from 24 so it gives 18.xyz hrs which is the correct value.
actually why this is happening is that the time format you selected is 12 hours instead of 24 hours and you are expecting results in 24 hours format.
One solution could be that change your date field format to 24 hours (by selecting custom display settings for these fields) and try to get the result. it will correctly show 18.5 hrs.