Skip to content

Instantly share code, notes, and snippets.

@irwinv
Created June 25, 2012 17:22
Show Gist options
  • Save irwinv/2989998 to your computer and use it in GitHub Desktop.
Save irwinv/2989998 to your computer and use it in GitHub Desktop.
Calcule des heures passé sur un test
$conn = $this->container->get('database_connection');
$tempspasse = $conn->fetchAll(
"SELECT *, MIN(ddt.datedebut) FROM DateDebutTest ddt
LEFT JOIN ResultatsTests rt ON ddt.utilisateur_id = rt.utilisateur_id
WHERE rt.test_id = ddt.test_id
&& rt.question_id = ddt.question_id
&& ddt.test_id = $id"
);
$datedebut = new \Datetime($tempspasse[0]['datedebut']);
$datefin = new \Datetime($tempspasse[0]['date_fin']);
$diff = $datedebut->diff($datefin);
// $temp_examen= $diff->format('%y-%m-%d %h:%i:%s');
$temp_examen= $diff->format('%h hr : %i mm : %s sec');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment