Tutoriel PHP

ACCUEIL PHP Introduction PHP Installation PHP Syntaxe PHP Commentaires PHP Variables PHP Écho PHP / Impression Types de données PHP Chaînes PHP Numéros PHP Mathématiques PHP Constantes PHP Opérateurs PHP PHP Si... Sinon... Sinon Commutateur PHP Boucles PHP Fonctions PHP Tableaux PHP Superglobales PHP Expression régulière PHP

Formulaires PHP

Gestion des formulaires PHP Validation de formulaire PHP Formulaire PHP requis URL/courriel du formulaire PHP Formulaire PHP terminé

PHP Avancé

Date et heure PHP Inclure PHP Gestion des fichiers PHP Fichier PHP Ouvrir/Lire Création/écriture de fichier PHP Téléchargement de fichier PHP Cookies PHP Séances PHP Filtres PHP Filtres PHP avancés Fonctions de rappel PHP PHPJSON Exception PHP

POO PHP

PHP Qu'est-ce que la POO Classes/Objets PHP Constructeur PHP Destructeur PHP Modificateurs d'accès PHP Héritage PHP Constantes PHP Classes abstraites PHP Interface PHP Caractéristiques PHP Méthodes statiques PHP Propriétés statiques PHP Espaces de noms PHP Itérables PHP

Base de données MySQL

Base de données MySQL Connexion MySQL Créer une base de données MySQL Créer une table MySQL MySQL Insérer des données MySQL obtenir le dernier ID MySQL Insérer plusieurs MySQL préparé MySQL Sélectionner les données MySQL Où Trier MySQL par MySQL Supprimer les données Données de mise à jour MySQL Données de limite MySQL

XML PHP

Analyseurs PHP XML Analyseur PHP SimpleXML PHP SimpleXML - Obtenir Expatriation PHP XML PHP XML DOM

PHP -AJAX

Introduction à AJAX PHP AJAX Base de données AJAX XML AJAX Recherche en direct AJAX Sondage AJAX

Exemples PHP

Exemples PHP Compilateur PHP Questionnaire PHP Exercices PHP Certificat PHP

Référence PHP

Présentation de PHP Tableau PHP Calendrier PHP Date PHP Annuaire PHP Erreur PHP Exception PHP Système de fichiers PHP Filtre PHP FTP PHP PHPJSON Mots clés PHP PHP LibxmlComment Messagerie PHP Mathématiques PHP Divers PHP PHP MySQL Réseau PHP Contrôle de sortie PHP Expression régulière PHP PHP SimpleXML Flux PHP Chaîne PHP Gestion des variables PHP Analyseur PHP XML Code postal PHP Fuseaux horaires PHP

Fonction PHP date_create_from_format()

❮ Référence date/heure PHP

Exemple

Renvoie un nouvel objet DateTime formaté selon le format spécifié :

<?php
$date=date_create_from_format("j-M-Y","15-Mar-2013");
?>

Définition et utilisation

La fonction date_create_from_format() renvoie un nouvel objet DateTime formaté selon le format spécifié.


Syntaxe

date_create_from_format(format, time, timezone)

Valeurs des paramètres

Parameter Description
format Required. Specifies the format to use. The following characters can be used in the format parameter string:
  • d - Day of the month; with leading zeros
  • j - Day of the month; without leading zeros
  • D - Day of the month (Mon - Sun)
  • l - Day of the month (Monday - Sunday)
  • S - English suffix for day of the month (st, nd, rd, th)
  • F - Monthname (January - December)
  • M - Monthname (Jan-Dec)
  • m - Month (01-12)
  • n - Month (1-12)
  • Y - Year (e.g 2013)
  • y - Year (e.g 13)
  • a and A - am or pm
  • g - 12 hour format without leading zeros
  • G - 24 hour format without leading zeros
  • h - 12 hour format with leading zeros
  • H - 24 hour format with leading zeros
  • i - Minutes with leading zeros
  • s - Seconds with leading zeros
  • u - Microseconds (up to six digits)
  • e, O, P and T - Timezone identifier
  • U - Seconds since Unix Epoch
  • (space)
  • # - One of the following separation symbol: ;,:,/,.,,,-,(,)
  • ? - A random byte
  • * - Random bytes until next separator/digit
  • ! - Resets all fields to Unix Epoch
  • | - Resets all fields to Unix Epoch if they have not been parsed yet
  • + - If present, trailing data in the string will cause a warning, not an error
time Required. Specifies a date/time string. NULL indicates the current date/time
timezone Optional. Specifies the timezone of time. Default is the current timezone


Détails techniques

Valeur de retour : Retourne un nouvel objet DateTime en cas de succès. FAUX en cas d'échec
Version PHP : 5.3+

❮ Référence date/heure PHP