I am developing an application in Apex 5. On a page I placed a tabular form. The tabular form has a from-date field and a to-date field. I want to create a computed column on the form which is the difference in hours between the from and to dates. I have a JavaScript function which will display a computed column on the tabular form as follows:
function f_calculate_total(pThis) {
var logged = 0;
var row_id = pThis.id.substr(4);
var start_time = $('#f09_'+row_id).val();
var end_time = $('#f11_'+row_id).val();
logged = 24*(0.16);
$('#f13_'+row_id).val(logged);
}
The names of the dependent columns are computed column f13, from-date f09, and to-date f11.
The from date and to-date both have the element attributes property set to:
onchange="f_calculate_total(this);"
The function works and displays the computed value of the variable named logged.
My question is, what is the JavaScript to compute the difference between the date-times end_time minus start_time?
Thank you