# Posted By

olive on 08/22/06

# Statistics

Viewed 305 times
Favorited by 0 user(s)

# Fonctions dates

/ Published in: PHP
`// Affichage d'une chaine de la forme YYYYMMJJsprintf("%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";}`