i need your help, 1) i want to show 2 datetime fields (start time and finish time) but without the long format dd/mm/yyyy, only the hours and the minutes
2) and of course calculate the difference between the finish and start times What formula should I use please?
exemple : Start time 02:15 finish time 03: 28 Result 01:13
To hide the date component in the date/time fields, untick the “Show input field for the date” checkbox in their settings, and to activate the time components, tick the “Include time” checkbox.
Assuming the date/time fields are fieldname1 and fieldname2, insert a calculated field in the form and enter the equation:
(function(){
var o = DATEDIFF( fieldname1, fieldname2, 'hh:ii', 'h');
return CONCATENATE(o['hours'], ':', o['minutes']);
})()
To continue in the same project, I would like to sum 2 times differences
Exemple : – Morning Start Time, Morning Finish Time, the difference – Afternoon Start Time, Afternoon Finish Time, the difference – and the Sum of the 2 differences (see the photo)
the difficulty is that I can’t do any operation with the results calculated previously, they are concatenated values
Actually, does not matter if they are concatenated. It is a text with time format. For can use exactly the same operation, but entering the names of the calculated fields:
(function(){
var o = DATEDIFF( fieldname1, fieldname2, 'hh:ii', 'h');
return CONCATENATE(o['hours'], ':', o['minutes']);
})()
If you want to add values in time format, the correct process would be to transform them to the same unit of measurement (such as minutes), add the result, and finally, transform the value to hours:minutes format.
For example, if the calculated fields are fieldname1 and fieldname2, respectively: