My problem is reported widely in forum of Drupal.org.
Currently i am havind trouble to print the data od the specific field in the views using the Global:php field.
I would klike to calculate the difference between two different dates in the same field. This field is the Multi field type.
I had searched for the issue but not succeeded yet. The following methods i had applied for the same.
Method 1:
<?php
$start = $row->field_experience_faculty_field_duration_exp_value;
$stop = strtotime($row->field_experience_faculty_field_duration_exp_value2);
$time_elapsed=$stop-$start;
$minutes=$time_elapsed/60;
$hours=$minutes/60;
?>
Method 2:
<?php
$node = node_load($row->field_experience_faculty_field_duration_exp_value);
echo $node->field_experience_faculty_field_duration_exp_value['und'][0]['value'];
?>
Method 3:
<?php
$test = $data->_field_data['nid']['entity']->field_data_field_experience_faculty_field_experience_faculty['und'][0]['value'];
print $test;
?>
Method 4:
<?php
$start_value = $row->field_experience_faculty_field_duration_exp_value;
$end_value = $row->field_experience_faculty_field_duration_exp_value2;
$start_date = new DateObject($start_value);
$end_date = new DateObject($end_value);
$duration = $start_date->diff($end_date);
echo $duration;
?>
Upon printing all the available fields using the Print_r method, following output has been generated.
stdClass Object
(
[node_title] => Ms. Anal Kirtikumar Patel
[nid] => 751
[field_data_field_experience_faculty_delta] => 0
[field_data_field_experience_faculty_language] => und
[field_data_field_experience_faculty_bundle] => faculty
[field_data_field_experience_faculty_field_experience_faculty] => 2016-07-16 00:00:00
[field_data_field_experience_faculty_field_experience_faculty_1] => 2016-07-16 00:00:00
[field_data_field_experience_faculty_field_experience_faculty_2] =>
[node_created] => 1468674110
[field_data_field_experience_faculty_node_entity_type] => node
[_field_data] => Array
(
[nid] => Array
(
[entity_type] => node
[entity] => stdClass Object
(
[vid] => 751
[uid] => 71
[title] => Ms. test
[log] =>
[status] => 1
[comment] => 0
[promote] => 0
[sticky] => 0
[nid] => 751
[type] => faculty
[language] => und
[created] => 1468674110
[changed] => 1468830641
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1468830641
[revision_uid] => 1
[field_post_affiliation_faculty] => Array
(
[und] => Array
(
[0] => Array
(
[value] => Assistant Professor
[format] =>
[safe_value] => Assistant Professor
)
)
)
Kindly help me to print the data from multifield in and calculate the difference between both the dates.