PHP Doku:: Sets up a DateInterval from the relative parts of the string - dateinterval.createfromdatestring.html

Verlauf / Chronik / History: (5) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatums- und zeitrelevante ErweiterungenDatum und UhrzeitThe DateInterval classDateInterval::createFromDateString

Ein Service von Reinhard Neidl - Webprogrammierung.

The DateInterval class

<<DateInterval::__construct

DateInterval::format>>

DateInterval::createFromDateString

(PHP 5 >= 5.3.0)

DateInterval::createFromDateStringSets up a DateInterval from the relative parts of the string

Beschreibung

public static DateInterval DateInterval::createFromDateString ( string $time )

Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string.

Parameter-Liste

time

Date with relative parts.

Rückgabewerte

Returns new DateInterval instance if success.


2 BenutzerBeiträge:
- Beiträge aktualisieren...
msleman at boot dot dot dot com
29.10.2010 5:39
Sample usage:

<?php
$interval
= DateInterval::createFromDateString('1 month');
?>
Anonymous
28.09.2009 21:02
DateInterval::createFromDateString ( string $time )

When the manual says "Uses the normal date parsers" it means that this function cannot take $time = ISO8601 strings like "P7D".  If you want to use those, you must use the constructor.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)