Time Interval in weorm

Events happening in the community are now at Drupal community events on www.drupal.org.
yuvaraju.an's picture

Hi,

how to calculate time interval (closing time - opening time), I am using form id alter hook. time is stored as an array. it is working fine for the integer Please help me.

function webform_calc_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'webform_client_form_21') {
$form['#validate'][] = 'webform_calc_validate';
}
}

function webform_calc_validate($form, &$form_state) {
switch($form_state['input']['details']['page_num']) {
case '1':
$okm = $form_state['input']['submitted']['opening_kilometer'];
$ckm = $form_state['input']['submitted']['closing_kilometer'];
$total = $ckm - $okm;

   form_set_value(
   $form['submitted']['total_km'], $total, $form_state); 

 $ot = $form_state['input']['submitted']['opening_time'];
     $ct = $form_state['input']['submitted']['closing_time'];
 $totaltime = $ct1 - $ot1;      

   form_set_value(
   $form['submitted']['total_time'], $totaltime, $form_state); 

break;

}
return $form;

India

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: