begin process at 2008 08 29 05:44:04
1 233 513 membres
53 nouveaux aujourd'hui
14 291 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

FONCTION DATE() EN FRANÇAIS


Information sur la source

Catégorie :Date / Heure Niveau : Débutant Date de création : 21/05/2002 Date de mise à jour : 21/05/2002 01:29:39 Vu / téléchargé: 4 892 / 122

Note :
5 / 10 - par 1 personne
5,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (4)
Ajouter un commentaire et/ou une note

Description

La fonction Date() traduite entiérement en Français...

Source

  • // Function DateFR(date to return, [timestamp])
  • // By CalistX
  • // 11/05/02 - 21:41
  • Function DateFR($what_date, $timestamp = "") {
  • $returned = FALSE;
  • $jour_c = Array("Mon" => "Lun", "Tue" => "Mar", "Wed" => "Mer", "Thu" => "Jeu", "Fri" => "Ven", "Sat" => "Sam", "Sun" => "Dim");
  • $jour_l = Array("Monday" => "Lundi", "Tuesday" => "Mardi", "Wednesday" => "Mercredi", "Thursday" => "Jeudi", "Friday" => "Vendredi", "Saturday" => "Samedi", "Sunday" => "Dimanche");
  • $mois_c = Array("1" => "Jan", "2" => "Fév", "3" => "Mar", "4" => "Avr", "5" => "Mai", "6" => "Jui", "7" => "Jui", "8" => "Aoû", "9" => "Sep", "10" => "Oct", "11" => "Nov", "12" => "Déc");
  • $mois_l = Array("1" => "Janvier", "2" => "Février", "3" => "Mars", "4" => "Avril", "5" => "Mai", "6" => "Juin", "7" => "Juillet", "8" => "Août", "9" => "Septembre", "10" => "Octobre", "11" => "Novembre", "12" => "Décembre");
  • If ($what_date == "a") {
  • If (Date("a", $timestamp) == "am") {
  • return "matin";
  • $returned = TRUE;
  • }
  • If (Date("a", $timestamp) == "pm") {
  • return "après-midi";
  • $returned = TRUE;
  • }
  • If (empty($timestamp)) {
  • return "Timestamp Incorrect";
  • $returned = TRUE;
  • }
  • }
  • If ($what_date == "A") {
  • If (Date("A", $timestamp) == "AM") {
  • return "MATIN";
  • $returned = TRUE;
  • }
  • If (Date("A", $timestamp) == "PM") {
  • return "APRES-MIDI";
  • $returned = TRUE;
  • }
  • If (empty($timestamp)) {
  • return "Timestamp Incorrect";
  • $returned = TRUE;
  • }
  • }
  • If ($what_date == "B") {
  • return Date("B");
  • $returned = TRUE;
  • }
  • If ($what_date == "d") {
  • return Date("d");
  • $returned = TRUE;
  • }
  • If ($what_date == "D") {
  • return $jour_c[Date("D")];
  • $returned = TRUE;
  • }
  • If ($what_date == "F") {
  • return $mois_l[Date("n")];
  • $returned = TRUE;
  • }
  • If ($what_date == "g") {
  • return Date("g");
  • $returned = TRUE;
  • }
  • If ($what_date == "G") {
  • return Date("G");
  • $returned = TRUE;
  • }
  • If ($what_date == "h") {
  • return Date("h");
  • $returned = TRUE;
  • }
  • If ($what_date == "H") {
  • return Date("H");
  • $returned = TRUE;
  • }
  • If ($what_date == "i") {
  • return Date("i");
  • $returned = TRUE;
  • }
  • If ($what_date == "I") {
  • return Date("I");
  • $returned = TRUE;
  • }
  • If ($what_date == "j") {
  • return Date("j");
  • $returned = TRUE;
  • }
  • If ($what_date == "l") {
  • return $jour_l[Date("l")];
  • $returned = TRUE;
  • }
  • If ($what_date == "L") {
  • return Date("L");
  • $returned = TRUE;
  • }
  • If ($what_date == "m") {
  • return Date("m");
  • $returned = TRUE;
  • }
  • If ($what_date == "M") {
  • return $mois_c[Date("n")];
  • $returned = TRUE;
  • }
  • If ($what_date == "n") {
  • return Date("n");
  • $returned = TRUE;
  • }
  • If ($what_date == "O") {
  • return Date("O");
  • $returned = TRUE;
  • }
  • If ($what_date == "r") {
  • return DateFR("D").", ".DateFR("d")." ".DateFR("M")." ".DateFR("Y")." ".DateFR("H").":".DateFR("i").":".DateFR("s")." ".DateFR("O");
  • $returned = TRUE;
  • }
  • If ($what_date == "s") {
  • return Date("s");
  • $returned = TRUE;
  • }
  • If ($what_date == "S") {
  • If (Date("S") == "th") {
  • return "éme";
  • $returned = TRUE;
  • }
  • If (Date("S") == "nd") {
  • return "ére";
  • $returned = TRUE;
  • }
  • }
  • If ($what_date == "t") {
  • return Date("t");
  • $returned = TRUE;
  • }
  • If ($what_date == "T") {
  • return Date("T");
  • $returned = TRUE;
  • }
  • If ($what_date == "U") {
  • return Date("U", $timestamp);
  • $returned = TRUE;
  • }
  • If ($what_date == "w") {
  • return Date("w");
  • $returned = TRUE;
  • }
  • If ($what_date == "Y") {
  • return Date("Y");
  • $returned = TRUE;
  • }
  • If ($what_date == "y") {
  • return Date("y");
  • $returned = TRUE;
  • }
  • If ($what_date == "Z") {
  • return Date("Z");
  • $returned = TRUE;
  • }
  • If ($what_date == "z") {
  • return Date("z");
  • $returned = TRUE;
  • }
  • If ($returned == FALSE) {
  • return Date($what_date);
  • }
  • }
// Function DateFR(date to return, [timestamp])
// By CalistX
// 11/05/02 - 21:41

Function DateFR($what_date, $timestamp = "") {
    $returned = FALSE;
    $jour_c = Array("Mon" => "Lun", "Tue" => "Mar", "Wed" => "Mer", "Thu" => "Jeu", "Fri" => "Ven", "Sat" => "Sam", "Sun" => "Dim");
    $jour_l = Array("Monday" => "Lundi", "Tuesday" => "Mardi", "Wednesday" => "Mercredi", "Thursday" => "Jeudi", "Friday" => "Vendredi", "Saturday" => "Samedi", "Sunday" => "Dimanche");	
	$mois_c = Array("1" => "Jan", "2" => "Fév", "3" => "Mar", "4" => "Avr", "5" => "Mai", "6" => "Jui", "7" => "Jui", "8" => "Aoû", "9" => "Sep", "10" => "Oct", "11" => "Nov", "12" => "Déc");
	$mois_l = Array("1" => "Janvier", "2" => "Février", "3" => "Mars", "4" => "Avril", "5" => "Mai", "6" => "Juin", "7" => "Juillet", "8" => "Août", "9" => "Septembre", "10" => "Octobre", "11" => "Novembre", "12" => "Décembre");
	
	If ($what_date == "a") {
	    If (Date("a", $timestamp) == "am") {
		    return "matin";
			$returned = TRUE;
		} 
		If (Date("a", $timestamp) == "pm") {
		    return "après-midi";
			$returned = TRUE;
		}
		If (empty($timestamp)) {
		    return "Timestamp Incorrect";
			$returned = TRUE;
		}
	}
	
	If ($what_date == "A") {
	    If (Date("A", $timestamp) == "AM") {
		    return "MATIN";
			$returned = TRUE;
		} 
		If (Date("A", $timestamp) == "PM") {
		    return "APRES-MIDI";
			$returned = TRUE;
		}
		If (empty($timestamp)) {
		    return "Timestamp Incorrect";
			$returned = TRUE;
		}
	}
	
	If ($what_date == "B") {
	    return Date("B");
		$returned = TRUE;
	}
	
	If ($what_date == "d") {
	    return Date("d");
		$returned = TRUE;
	}
	
	If ($what_date == "D") {
		return $jour_c[Date("D")];
		$returned = TRUE;
	}
	
	If ($what_date == "F") {
		return $mois_l[Date("n")];
		$returned = TRUE;
	}

	If ($what_date == "g") {
		return Date("g");
		$returned = TRUE;
	}

	If ($what_date == "G") {
		return Date("G");
		$returned = TRUE;
	}
	
	If ($what_date == "h") {
		return Date("h");
		$returned = TRUE;
	}
	
	If ($what_date == "H") {
		return Date("H");
		$returned = TRUE;
	}

	If ($what_date == "i") {
		return Date("i");
		$returned = TRUE;
	}
	
	If ($what_date == "I") {
		return Date("I");
		$returned = TRUE;
	}
	
	If ($what_date == "j") {
		return Date("j");
		$returned = TRUE;
	}

	If ($what_date == "l") {
		return $jour_l[Date("l")];
		$returned = TRUE;
	}

	If ($what_date == "L") {
		return Date("L");
		$returned = TRUE;
	}
	
	If ($what_date == "m") {
		return Date("m");
		$returned = TRUE;
	}
	
	If ($what_date == "M") {
		return $mois_c[Date("n")];
		$returned = TRUE;
	}
	
	If ($what_date == "n") {
		return Date("n");
		$returned = TRUE;
	}
	
	If ($what_date == "O") {
		return Date("O");
		$returned = TRUE;
	}

	If ($what_date == "r") {
		return DateFR("D").", ".DateFR("d")." ".DateFR("M")." ".DateFR("Y")." ".DateFR("H").":".DateFR("i").":".DateFR("s")." ".DateFR("O");
	    $returned = TRUE;
	}
	
	If ($what_date == "s") {
		return Date("s");
		$returned = TRUE;
	}
	
	If ($what_date == "S") {
	    If (Date("S") == "th") {
		    return "éme";
			$returned = TRUE;
		} 
		If (Date("S") == "nd") {
		    return "ére";
			$returned = TRUE;
		}
	}
	
	If ($what_date == "t") {
		return Date("t");
		$returned = TRUE;
	}
	
	If ($what_date == "T") {
		return Date("T");
		$returned = TRUE;
	}
	
	If ($what_date == "U") {
		return Date("U", $timestamp);
		$returned = TRUE;
	}
	
	If ($what_date == "w") {
		return Date("w");
		$returned = TRUE;
	}
	
	If ($what_date == "Y") {
		return Date("Y");
		$returned = TRUE;
	}
	
	If ($what_date == "y") {
		return Date("y");
		$returned = TRUE;
	}
	
	If ($what_date == "Z") {
		return Date("Z");
		$returned = TRUE;
	}
	
	If ($what_date == "z") {
		return Date("z");
		$returned = TRUE;
	}
	
	If ($returned == FALSE) {
	    return Date($what_date);
	}
} 

Conclusion

Petit probléme : La fonction ne connait pas plusieurs arguments comme DateFR("h F m") comme la fonction originale. Dans ces cas-là, elle transmet la commande à la fonction originale.
Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

  • signaler à un administrateur
    Commentaire de OverDarck le 26/03/2003 19:21:38

    Waou !
    Ta pas plus long ??

  • signaler à un administrateur
    Commentaire de OverDarck le 26/03/2003 19:21:38

    Waou !
    Ta pas plus long ??

  • signaler à un administrateur
    Commentaire de zzzzzz le 18/05/2004 22:16:19

    sympas overdarck

  • signaler à un administrateur
    Commentaire de sensoide le 21/07/2006 09:50:53

    Il y avait plus simple.

    setlocale(LC_TIME, "fr"); // passefacilement la date en français

    $date=strftime("%B").' '.date("Y");

    apres il suffit d'aller voir dans le tuto a date(); pour connaitre les differents mode d'affichage.

    Merci

Ajouter un commentaire

Pub



Appels d'offres

Recherche developpeur ...
Budget : 700€
SITE MARCHAND LOCATION...
Budget : 3 000€
SITE MARCHAND POUR HOTEL
Budget : 4 000€

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

Boutique

Boutique de goodies CodeS-SourceS