Latest web development tutorials
×

PHP Kurs

PHP Kurs PHP Kurze Einführung PHP installieren PHP Grammatik PHP Variable PHP echo/print PHP Datentypen PHP Konstante PHP Schnur PHP Die Betreiber PHP If...Else PHP Switch PHP Feld PHP Sortieren eines Array PHP Superglobals PHP While Verkehr PHP For Verkehr PHP Funktion PHP Magische Variablen PHP Namespaces PHP Objektorientiert

PHP Form

PHP Form PHP Formularauthentifizierung PHP Form - Erforderliche Felder PHP Form - Überprüfung E-Mail und URL PHP Komplette Formularinstanz PHP $_GET Variable PHP $_POST Variable

PHP Erweiterte Tutorial

PHP Mehrdimensionale Arrays PHP Datum PHP enthalten PHP Datei PHP Datei-Upload PHP Cookie PHP Session PHP E-mail PHP Sicherheit E-mail PHP Error PHP Exception PHP Filter PHP Erweiterte Filter PHP JSON

PHP 7 Neue Funktionen

PHP 7 Neue Funktionen

PHP Datenbank

PHP MySQL Kurze Einführung PHP MySQL Verbindung PHP MySQL Erstellen einer Datenbank PHP MySQL Erstellen Sie eine Datentabelle PHP MySQL einfügen von Daten PHP MySQL Legen Sie mehrere Daten PHP MySQL Prepared Statements PHP MySQL Lesen Sie Daten PHP MySQL WHERE PHP MySQL ORDER BY PHP MySQL UPDATE PHP MySQL DELETE PHP ODBC

PHP XML

XML Expat Parser XML DOM XML SimpleXML

PHP & AJAX

AJAX Kurze Einführung AJAX PHP AJAX Datenbank AJAX XML AJAX Echtzeitsuche AJAX RSS Reader AJAX Abstimmung

PHP Referenzhandbuch

PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Bildverarbeitung PHP RESTful

PHP date_interval_format () / DateInterval :: Format () Funktion

PHP Datum / Uhrzeit PHP Datum / Zeit - Referenzhandbuch

Das Intervall zwischen zwei Daten und formatieren Sie dann das Intervall:

Beispiele

<? Php
$ Date1 = date_create ( "2013-01-01" );
$ Date2 = date_create ( "2013.02.10" );
$ Diff = date_diff ($ date1, $ date2);

//% Einer Gesamtleistung von zwischen zwei Terminen Tage
echo $ diff -> Format ( "Gesamtzahl der Tage für den gewünschten Zeitraum ein :% pro Tag.");
?>

Ausführung einer Instanz »

Definition und Verwendung

date_interval_format () Funktion ist DateInterval :: Format () alias.

DateInterval :: Format () Funktion wird verwendet, Zeitintervalle zu formatieren.

Grammatik

DateInterval::format( format);

参数 描述
format 必需。规定格式。 format 参数字符串可以使用下列的字符:
  • % - Literal %
  • Y - 年,至少 2 个数字,带前导零(例如 03)
  • y - 年(例如 3)
  • M - 月,带前导零(例如 06)
  • m - 月(例如 6)
  • D - 日,带前导零(例如 09)
  • d - 日(例如 9)
  • a - 由 date_diff() 得出的两个日期间隔的总天数
  • H - 小时,带前导零(例如 08、23)
  • h - 小时(例如 8、23)
  • I - 分,带前导零(例如 08、23)
  • i - 分(例如 8、23)
  • S - 秒,带前导零(例如 08、23)
  • s - 秒(例如 8、23)
  • R - 当负数时为符号 "-",当正数时为符号 "+"
  • r - 当负数时为符号 "-",当正数时为空

注意:每个格式字符串必须带一个 % 符作为前缀!

Technische Details

Rückkehr: Returns Zeitintervall formatiert.
PHP-Version: 5.3+


PHP Datum / Uhrzeit PHP Datum / Zeit - Referenzhandbuch