Skip to content

Instantly share code, notes, and snippets.

@morad7
Created October 22, 2015 11:45
Show Gist options
  • Save morad7/c821f40647dfd4b56a9c to your computer and use it in GitHub Desktop.
Save morad7/c821f40647dfd4b56a9c to your computer and use it in GitHub Desktop.
Drupal: calculate date differnece using views php
<?php
$date_start = new DateTime($data->field_field_date_conge[0]['raw']['value']);
$date_end = new DateTime($data->field_field_date_conge[0]['raw']['value2']);
$diff=date_diff($date_start,$date_end);
echo $diff->format("%a jours");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment