Onchange
Posted: Tue Jun 26, 2012 11:43 pm
Hi,
Can somebody help me to automate the total of hours on my field.
ex I have 3 fields
datetime1 = textfield
datetime2 = textfield
total = textfield
I want to show the result in my total field when I select the date/time in my datetime1 and datetime2 it should be automated field.. below is my code..
$date1 = new DateTime($textFromDate);
$date2 = new DateTime($textToDate);
$diff = $date2->diff($date1);
$hours = $diff->h;
$hours = $hours + ($diff->d*8);
$total = $hours / $per_day;
Thank you very much!
Can somebody help me to automate the total of hours on my field.
ex I have 3 fields
datetime1 = textfield
datetime2 = textfield
total = textfield
I want to show the result in my total field when I select the date/time in my datetime1 and datetime2 it should be automated field.. below is my code..
$date1 = new DateTime($textFromDate);
$date2 = new DateTime($textToDate);
$diff = $date2->diff($date1);
$hours = $diff->h;
$hours = $hours + ($diff->d*8);
$total = $hours / $per_day;
Thank you very much!