Revision: 926
Updated Code
at August 22, 2006 08:38 by olive
Updated Code
// Affichage d'une chaine de la forme YYYYMMJJ sprintf("%02d/%02d/%04d", substr($date,6,2), substr($date,4,2), substr($date,0,4)); // Chaine YYYYMMJJ representant la date $date_courante = date("YmdHis", time()); // Chaine YYYYMMJJ representant la date d'hier $date=date("Ymd", mktime(0, 0, 0, date("m") , date("d") - 1, date("Y"))); //h:m:s entre 2 dates $time_submitted=mktime(substr($bug["date_submitted"],11,2),substr($bug["date_submitted"],14,2),substr($bug["date_submitted"],17,2),substr($bug["date_submitted"],5,2),substr($bug["date_submitted"],8,2),substr($bug["date_submitted"],0,4)); $time_resolved=mktime(substr($bug["date_resolved"],11,2),substr($bug["date_resolved"],14,2),substr($bug["date_resolved"],17,2),substr($bug["date_resolved"],5,2),substr($bug["date_resolved"],8,2),substr($bug["date_resolved"],0,4)); $bug["time_to_resolve"]=calcul_hours($time_resolved-$time_submitted); function calcul_hours($temps) { //combien d'heures ? $hours = floor($temps / 3600); //combien de minutes ? $min = floor(($temps - ($hours * 3600)) / 60); if ($min < 10) $min = "0".$min; //combien de secondes $sec = $temps - ($hours * 3600) - ($min * 60); if ($sec < 10) $sec = "0".$sec; return $hours."h".$min."m".$sec."s"; }
Revision: 925
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 22, 2006 08:37 by olive
Initial Code
- Affichage d'une chaine de la forme YYYYMMJJ : sprintf("%02d/%02d/%04d", substr($date,6,2), substr($date,4,2), substr($date,0,4)) - Chaine YYYYMMJJ representant la date : $date_courante = date("YmdHis", time()); - Chaine YYYYMMJJ representant la date d'hier : $date=date("Ymd", mktime(0, 0, 0, date("m") , date("d") - 1, date("Y"))); h:m:s entre 2 dates //2005-06-27 10:28:21 $time_submitted=mktime(substr($bug["date_submitted"],11,2),substr($bug["date_submitted"],14,2),substr($bug["date_submitted"],17,2),substr($bug["date_submitted"],5,2),substr($bug["date_submitted"],8,2),substr($bug["date_submitted"],0,4)); $time_resolved= mktime(substr($bug["date_resolved"],11,2),substr($bug["date_resolved"],14,2),substr($bug["date_resolved"],17,2),substr($bug["date_resolved"],5,2),substr($bug["date_resolved"],8,2),substr($bug["date_resolved"],0,4)); $bug["time_to_resolve"]=calcul_hours($time_resolved-$time_submitted); function calcul_hours($temps) { //combien d'heures ? $hours = floor($temps / 3600); //combien de minutes ? $min = floor(($temps - ($hours * 3600)) / 60); if ($min < 10) $min = "0".$min; //combien de secondes $sec = $temps - ($hours * 3600) - ($min * 60); if ($sec < 10) $sec = "0".$sec; return $hours."h".$min."m".$sec."s"; }
Initial URL
Initial Description
Initial Title
Fonctions dates
Initial Tags
date
Initial Language
PHP