Esercitazione PHP

PHP HOME Introduzione a PHP Installazione PHP Sintassi PHP Commenti PHP Variabili PHP PHP Eco/Stampa Tipi di dati PHP Stringhe PHP Numeri PHP PHP matematica Costanti PHP Operatori PHP PHP Se...Altro...Altro Passaggio PHP Ciclo PHP Funzioni PHP Matrici PHP Superglobali PHP RegEx PHP

Moduli PHP

Gestione dei moduli PHP Convalida del modulo PHP Modulo PHP richiesto URL/e-mail del modulo PHP Modulo PHP completo

PHP avanzato

Data e ora PHP PHP Include Gestione dei file PHP Apri/Leggi file PHP Creazione/scrittura di file PHP Caricamento file PHP Cookie PHP Sessioni PHP Filtri PHP Filtri PHP avanzati Funzioni di callback PHP PHP JSON Eccezioni PHP

PHP OOP

PHP Che cos'è OOP Classi/Oggetti PHP Costruttore PHP PHP distruttore Modificatori di accesso PHP Ereditarietà PHP Costanti PHP Classi astratte PHP Interfacce PHP Tratti PHP Metodi statici PHP Proprietà statiche PHP Spazi dei nomi PHP Iterabili PHP

Database MySQL

Database MySQL MySQL Connect MySQL Crea DB MySQL Crea tabella Dati di inserimento MySQL MySQL Ottieni l'ultimo ID MySQL inserisce più MySQL preparato MySQL Seleziona dati MySQL dove MySQL Ordina per MySQL Elimina dati Dati di aggiornamento MySQL Dati limite MySQL

PHP XML

Parser XML PHP Analizzatore PHP SimpleXML PHP SimpleXML - Ottieni PHP XML espatriato PHP XML DOM

PHP - AJAX

Introduzione all'Ajax AJAX PHP Database AJAX XML AJAX Ricerca in tempo reale AJAX Sondaggio AJAX

Esempi PHP

Esempi PHP compilatore PHP Quiz PHP Esercizi PHP Certificato PHP

Riferimento PHP

Panoramica di PHP matrice PHP Calendario PHP Data PHP Directory PHP Errore PHP Eccezione PHP File system PHP Filtro PHP PHP FTP PHP JSON Parole chiave PHP PHP Libxml Posta PHP PHP matematica PHP Varie PHP MySQLi Rete PHP Controllo dell'output PHP RegEx PHP PHP SimpleXML Flusso PHP Stringa PHP Gestione delle variabili PHP Analizzatore XML PHP Zip PHP Fuso orario PHP

PHP date_create_from_format() Funzione

❮ Riferimento di data/ora PHP

Esempio

Restituisce un nuovo oggetto DateTime formattato secondo il formato specificato:

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

Definizione e utilizzo

La funzione date_create_from_format() restituisce un nuovo oggetto DateTime formattato in base al formato specificato.


Sintassi

date_create_from_format(format, time, timezone)

Valori dei parametri

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


Dettagli tecnici

Valore di ritorno: Restituisce un nuovo oggetto DateTime in caso di successo. FALSO in caso di fallimento
Versione PHP: 5.3+

❮ Riferimento di data/ora PHP