Je cherche comment déterminer le jour de la semaine en fonction d'un champ timestamp

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
function pretty_date2($date) {
  /* on décrète que $date est une date valide, i.e. sous la forme
   * YYYYMMDD ou YYYYMM
   */
  $mois_matching = array(0 => 'janvier',
    1 => 'février',
    2 => 'mars',
    3 => 'avril',
    4 => 'mai',
    5 => 'juin',
    6 => 'juillet',
    7 => 'août',
    8 => 'septembre',
    9 => 'octobre',
    10 => 'novembre',
    11 => 'décembre'
    );
 
 
 
  $y = substr($date,0,4);
  $m = substr($date,4,2);
  $m = $mois_matching[$m-1];
  $d = "";
  if ( strlen($date) == 8 ) {
    $d = (int)substr($date,6,2);
    if ( $d == 1 ) {
      $d .= "er";
    }
    $d .= " ";
  }
  else {
    $m = ucfirst($m);
  }
 
  return  $d . $m . " " . $y;
}
Cela m'affiche "16 mai 2006"

et je voudrai affiche "mardi 16 mai 2006"

Dans la base mysql champ timestamp(8) exemple "20060516"

Voilà je vous remerci d'avance